Adding more modifications
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
package ro.stefan;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class SwaggerGroupingUsingTagsExampleApp {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SwaggerGroupingUsingTagsExampleApp.class, args);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,44 @@
|
||||
package ro.stefan.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
import springfox.documentation.builders.ApiInfoBuilder;
|
||||
import springfox.documentation.builders.PathSelectors;
|
||||
import springfox.documentation.builders.RequestHandlerSelectors;
|
||||
import springfox.documentation.service.ApiInfo;
|
||||
import springfox.documentation.service.Contact;
|
||||
import springfox.documentation.service.Tag;
|
||||
import springfox.documentation.spi.DocumentationType;
|
||||
import springfox.documentation.spring.web.plugins.Docket;
|
||||
|
||||
@Configuration
|
||||
public class SpringFoxConfig {
|
||||
|
||||
|
||||
@Bean
|
||||
public Docket api3() {
|
||||
// here tags is optional, it just adds a description in the UI
|
||||
// by default description is class name, so if you use same tag using
|
||||
// `@Api` on different classes it will pick one of the class name as
|
||||
// description, so better define your own description for them
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.apiInfo(apiInfo())
|
||||
.tags(new Tag("security", "security related"),
|
||||
new Tag("loan", "loan related"))
|
||||
.select()
|
||||
.apis(RequestHandlerSelectors.basePackage("ro.stefan.external.apis"))
|
||||
.paths(PathSelectors.any())
|
||||
.build();
|
||||
}
|
||||
|
||||
private ApiInfo apiInfo() {
|
||||
return new ApiInfoBuilder()
|
||||
.title("Openapi OAS3 with springfox ")
|
||||
.description("Code first approach")
|
||||
.version("1.0.0")
|
||||
.contact(new Contact("Marone", "https://wstutorial.com", "test@wstutorial.com"))
|
||||
.build();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package ro.stefan.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class BookController {
|
||||
|
||||
@GetMapping("/books")
|
||||
public List<String> getBooks(){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package ro.stefan.external.apis.accounting.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class AccountingController {
|
||||
|
||||
@GetMapping("/accounts")
|
||||
public List<String> getAccounts(){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package ro.stefan.external.apis.address.controller;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@RestController
|
||||
public class AddressController {
|
||||
|
||||
@GetMapping("/addresses")
|
||||
public List<String> getAddresses(){
|
||||
return null;
|
||||
}
|
||||
}
|
||||
16
SwaggerApiInfoExample/src/main/java/ro/stefan/external/apis/loan/controller/LoanController.java
vendored
Normal file
16
SwaggerApiInfoExample/src/main/java/ro/stefan/external/apis/loan/controller/LoanController.java
vendored
Normal file
@@ -0,0 +1,16 @@
|
||||
package ro.stefan.external.apis.loan.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "loan")
|
||||
public class LoanController {
|
||||
|
||||
@GetMapping("/loan")
|
||||
public String getLoanDetails() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package ro.stefan.external.apis.security.controller;
|
||||
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import io.swagger.annotations.Api;
|
||||
|
||||
@RestController
|
||||
@Api(tags = "security")
|
||||
public class SecurityController {
|
||||
@GetMapping("/user")
|
||||
public String getUser() {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
spring:
|
||||
mvc:
|
||||
pathmatch:
|
||||
matching-strategy: ant_path_matcher
|
||||
@@ -0,0 +1,13 @@
|
||||
package ro.stefan;
|
||||
|
||||
import org.junit.jupiter.api.Test;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
|
||||
@SpringBootTest
|
||||
class SwaggerGroupingUsingTagsExampleAppTests {
|
||||
|
||||
@Test
|
||||
void contextLoads() {
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user