the problem file XML configurations spring framework and JAVA can not change ? while in others they rather use now JSON ...
I guess you want to have a spring configuration using annotation. Follow link :
https://www.mkyong.com/spring3/spring-3-javaconfig-example/
And have JSON from java class. Link:
https://www.mkyong.com/java/how-do-convert-java-object-to-from-json-format-gson-api/
Related
Hi I am working on a legacy project where it is not possible to implement java based config because all the other beans are configured using XML based config. I want to know if there is a way to configure Jobrunr using XML based config. Thanks
I check out the source code but was not able to find anything.
We've created a Spring Boot application with some property sources configuring the modules of application. Now it comes to document configuration of the application. Instead of writing a separate document I'd like to document in code and create documentation.
First naiv approach would be to write property files like this and then generate a default application.properties (or yaml) to be adapted by end user:
a.b.c.myProperty=42
a.b.c.myProperty.desc=This is the documentation for myProperty
a.b.c.foo=baa
a.b.c.foo.desc=foo is the most important parameter ever!
Before reinventing the wheel, is there already some way to create configuration documentation out of my property sources?
I am using swagger to document my REST API. But i am using swagger annotation in my code like #API, #APIOperation etc. But i dont want to add these annotation. Is there any way to generate YAML or JSON file for REST API then use these files to describes, document and visualize REST API.
The YAML/JSON is just a documentation, you cant implement them by including this file, but you can provide this documentation e.g {yourAPI}/swagger.yaml.
I am absolutly new in Swagger and I have the following doubt:
I know that gnerally I have to create Swagger document before code my REST API and the use this document to create my API (I know that from the Swagger Editor I can also generate my API server automatically).
My problem is the following one:
I am working on a Java application (a Spring Boot application) that implements my REST API. I want to use Swagger to create my API documentation.
Exist a way to automatically do it? From my Java code to the Swagger yaml file? For example annoting my Java code in some way that could be parsed by some tool?
Yes, there is a tool which can easily generate the swagger documentation from the code you have already written.
This included into a Spring Appllication will create the documentation
https://springfox.github.io/springfox/docs/current/
To my mind this is the right way to it. Don't create a documentation and have the code generated, rather generate the documentation. That's the way Javadoc is created as well.
You don't need to annotate nothing in particular.
Create a class similar to the following to access the API with Swagger:
#Configuration
#EnableSwagger2
public class SwaggerConfig{
#Bean
public Docket api(){
return new Docket(DocumentationType.SWAGGER_2).select().apis(
RequestHandlerSelectors.basePackage("com.yourcompany.restcode")).paths(PathSelectors.any()).build();
}
}
Then access the API documentation with something like:
localhost:8080/swagger-ui.html#/
I am trying to use Enunciate to generate static documentation for my REST API that is written in Java using Spring MVC 3.2. The Enunciate website claims that it has Spring support by using a specific plugin here :
http://enunciate.codehaus.org/module_spring_app.html
When looking at the configuration options, it looks like I am supposed to import a spring applicationContext.xml. I use the annotation-based configuration for this project, so I don't have an applicationContext.xml. Is there a way to make this work in my case?
Thanks in advance for any help.
Enunciate currently supports Spring Web annotations.