Configuring Swagger with Play/Java-framework-2.5 - java

I am trying to configure Swagger with my Play-2.5 project.
I followed this tutorial and it worked, but only for the older version of Play and not working with Play-2.5. As the project has migrated into Play-2.5, we had to remove the swagger configuration.
Firstly, the issue seemed to be with static controller vs non static controller in Play-2.5, but I ended up with proving myself wrong.
I am facing this error
type ApiHelpController is not a member of package controllers
GET /api-docs controllers.ApiHelpController.getResources
If any one knows any link for Swagger configuration with Play-2.5 for Java, please guide.
PS: there are tutorials available for Scala not for java.

Try this repo:
https://github.com/CreditCardsCom/swagger-play
I created this as a temporary workaround until we get support for Play 2.5 in the official swagger-play repo.

I have only used the Play-Swagger project from Zalando. There is a lot of documentation and the repo is kept up-to-date.
If you want a quick start you can take a look at their Activator Template - just run it and you will get the Swagger generated documentation (Swagger UI is already included). From there you can start tweaking it (look for the conf/echo.yaml file).

The problem is, the com.wordnik swagger-play2(What your tutorial is using as a library) breaks with Play 2.4 and up.
You can try this which uses a different one (io.swagger). I have used this and it works well with 2.4. But it also breaks with 2.5.

Related

Cannot access javax.servlet.Filter class file for javax.servlet.Filter not found

I'm working in a project and right now I'm migrating the project to Spring 3.0. So I made some changes in some classes. I can not share the classes because of the job rules but this class about the AwsXrayConfig class. And using filter. But when I try to build project I'm getting this "cannot access javax.servlet.Filter" error. In the class I already updated javax to jakarta but AWSXRayServletFilter still using com.amazon.xray.javax.servlet.AWSXRayServletFilter library. So I'm stuck here. Also I'm not sure about looking the true place? Is that about jakarta or spring or aws libraries I''m not sure. Any ideas? Thx
I already removed import part about AWSXRayServletFilter but it's complaining. I changed javax.servlet.Filter to jakarta.servlet.Filter. Thats it
Thanks for bringing this to our attention.
There is an issue with the latest version of Spring since it is using Jakarta instead of javax.
I will add this as a work item for us.

How to find correct artifact id for a spring project

I started working with spring and I'm using maven.
I want to work with JMX support that spring provides.
I'm trying to include the dependency using maven. And for the same I went to mvnrepository and searched for spring. But I see a lot of projects with different artifact-id and I'm not sure which one should I start using and include as a dependency in my pom.xml.
I expected that I'd find this information here, but I didn't.
Is there a centralized place for spring where I could always go and find what is the artifact-id that I need to choose. I think I'm missing something obvious here.
In short my question is that say if I want to use spring's MBeanExporter is there any formal procedure to know that it is imported via spring-context?
Simply searching for the package name don't work org.springframework.jmx gives me a dependency of spring-jmx. Now I don't know what to use spring-jmx or spring-context
If you're still using spring 2.x then you probably want spring-jmx if you're using spring 3.x, 4.x or 5.x I believe the "org.springframework.jmx" package is provided as part of spring-context. Certainly if you look at the latest javadocs for spring-context(https://www.javadoc.io/doc/org.springframework/spring-context/5.1.3.RELEASE) the "org.springframework.jmx" package is included.

Using FatJarRouter when upgrading camel-spring-boot from 2.18 to 2.19

I was hoping I could get some clarification on a little problem we've been having.
Our project has been using a combination of camel and spring boot. We've been using a bunch of Camel modules, all version '2.18.3'.
Notably, we have been using the Camel module 'camel-spring-boot-starter', which depends on the 'camel-spring-boot' module which gives us the FatJarRouter class that we have been extending on our main class.
Recently, I've been trying to upgrade the main dependencies in our project, including Camel and spring boot. I've upgraded 'spring-boot-starter-parent' to version '1.5.4.RELEASE' and I've upgraded our Camel modules to '2.19.1'.
However, surprisingly, we found that the FatJarRouter class was no longer on our class path! I've tried looking through the change notes for 2.19, as well as Googling for more information but I can't find anything that mentions any change of procedure for using FatJars in Camel Spring Boot applications.
So my questions is this: Does anyone know if FatJarRouter has been removed or merely moved in Camel 2.19? If it has been moved, could you please point me in the direction of which artifact now holds it? If it has been removed, does anyone have any information on how FatJar applications should be tackled in Camel 1.19?
Thankyou for any help you can provide.
Its removed, just use regular RouteBuilder classes, see the existing examples for how to use Camel with Spring Boot: https://github.com/apache/camel/tree/master/examples#examples

Examples for com.google.gwt.app.place from GWT 2.1

The com.google.gwt.app.place package is new in GWT 2.1 which came out yesterday. Do you have any example on that API? How do I effectively use it? The GWT samples does't help at all.
I've seen Place used is in the scaffolding generated by the GWT plugin for Spring Roo.
If you want to generate a quick app to take a look:
start the roo console
>project --topLevelPackage com.testapp.test
>gwt setup
Then have a look at the generated code in the com.testapp.test.gwt.scaffold package.

Getting started with Spring 3 Web MVC - Setting everything up

I'm trying to get started with JAVA/Eclipse/Spring MVC but can't seem to find a "dummies" or "step-by-step" guide for setting everything up and creating the simplest proof-of-concept application.
I found http://static.springsource.org/docs/...-step-by-step/ but there seem to be differences between Spring 2.5 and Spring 3 so i'm looking for something for Spring 3.
Also, the tutorial for Spring 2.5 focuses on building the application usign Ant - This i will certainly be doing for releasing but when working within Eclipse i want to have set up the project so that i can use breakpoints/debugging and this is not covered at all.
I've downloaded Eclipse, Tomcat and the Spring 3 Framework but that's about it and within the downloaded Spring Framework documentation it states:
2.3 New getting started tutorial
There is now a new getting started tutorial
for developing a basic Spring 3.0 MVC
web application. This tutorial is a
separate document that can be found at
the Spring Documentation page
However, i can't seem to find such a tutorial on the linked page. My main problem at the moment, as seems to be the case for many people trying to get started with Spring, is that i can't seem to get everything set up.
I've got a copy of Expert Spring MVC and Web Flow and i've also found this tutorial but i don't know if the setups they describe are still relevant and whether they will allow debugging.
Can anyone please give some direction?
Thanks
Get the mvc-basic or the petcare sample apps from the Spring Samples SVN repository. These samples have been updated to Spring 3.0 and are directly importable & runnable with SpringSource Tool Suite.
I am also started to learn Spring 3.0 and i am not getting any help means any tutorials. but i find this site http://viralpatel.net/blogs/2010/06/spring-3-mvc-create-hello-world-application-spring-3-mvc.html and its very help full for start up development. but still i am finding another example so that i come to know more about it
if anybody knows some example in spring 3.0 then please provide me.
Thanks
Dhrumil Shah
These days, I think the easiest way to find out how to set up a spring application is by trying out Spring Roo. It may not be what you finally end up using when coding your project but it shows you exactly how to setup a Spring MVC web app.
I've also been looking all over for a full Spring MVC 3.0 tutorial with Eclipse that I could follow and haven't had too much luck in my research. The closest and most helpful example that I could find is here: http://krams915.blogspot.com/2011/01/spring-mvc-3-hibernate-annotations.html. This is also a maven project, but I was able to move some things around in my Dynamic Web Project within Eclipse and at least get the initial page to come up. Currently, I'm having issues with spring finding my controller class, but I think that's a part of changing the configuration files to meet my project needs. But try it and I hope it works for you!
I found these tutorials really helpful:
http://krams915.blogspot.ch/p/tutorials.html
I wanted to use REST and MongoDB and followed following tutorial with success:
http://krams915.blogspot.ch/2012/01/spring-mvc-31-implement-crud-with_4739.html
I hope it helps. I know how you feel :) Had the same issues. But it's worth sticking with Spring and learning it. It's a great framework once you know it.
Personally I made not so good experiences using Spring Roo. It can help you maybe a little bit for investigation how to setup a project but if you are new to Aspect Oriented Development you'll have a hard time figuring out what Spring Roo does. It can help you to setup a project really fast and easy but if you don't understand what's behind the facade it's hard working with it. This is not really for a beginner and no necessity for any project. But Aspect Oriented Development is worth wile learning and can be very useful to avoid boiler plate code.
Another route might be use appfuse, specifically using maven to generate the application template code from the appfuse archetype. E.g. this link.
There is a major difference in Spring 2.5 and Spring 3.x, Spring 3 or later introduces Annotations based bean wiring and dependency injection.
The nice step by step tutorial i found is http://www.journaldev.com/3531/spring-mvc-hibernate-mysql-integration-crud-example-tutorial

Categories