Spring Boot + Springfox springfox-boot-starter 3.0.0 Use

Use https://github.com/springfox/springfox.

build.gradle


plugins {
  id 'org.springframework.boot' version '2.3.2.RELEASE'
  id 'io.spring.dependency-management' version '1.0.9.RELEASE'
  id 'java'
}
group = 'com.example'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '11'
repositories {
  mavenCentral()
}
dependencies {
  implementation 'org.springframework.boot:spring-boot-starter-web'
  developmentOnly 'org.springframework.boot:spring-boot-devtools'
  testImplementation('org.springframework.boot:spring-boot-starter-test') {
    exclude group: 'org.junit.vintage', module: 'junit-vintage-engine'
  }
  // https://mvnrepository.com/artifact/io.springfox/springfox-boot-starter
  implementation 'io.springfox:springfox-boot-starter:3.0.0'
}
test {
  useJUnitPlatform()
}

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@SpringBootApplication
public class MainApp {
	@GetMapping("/hoge")
	public String hoge() {
		return "hoge";
	}
	
	public static void main(String[] args) {
		SpringApplication.run(MainApp.class, args);
	}
}

When you start it and access http: //localhost:8080/swagger-ui/index.html, the following screen will be displayed. Unlike 2.0 and earlier, there is auto-config, so there is no need to create java-config for swagger.

swagger333.jpg

Recommended Posts

Spring Boot + Springfox springfox-boot-starter 3.0.0 Use
Use Spring JDBC with Spring Boot
Use Basic Authentication with Spring Boot
Use DBUnit for Spring Boot test
How to use ModelMapper (Spring boot)
Beginning with Spring Boot 0. Use Spring CLI
Challenge Spring Boot
Use DynamoDB query method in Spring Boot
Spring Boot Form
Spring Boot Memorandum
gae + spring boot
Use cache with EhCashe 2.x with Spring Boot
How to use MyBatis2 (iBatis) with Spring Boot 1.4 (Spring 4)
How to use built-in h2db with spring boot
How to use Spring Boot session attributes (@SessionAttributes)
Use Servlet filter in Spring Boot [Spring Boot 1.x, 2.x compatible]
SPRING BOOT learning record 01
Spring Boot + Heroku Postgres
Spring boot memo writing (1)
First Spring Boot (DI)
SPRING BOOT learning record 02
Spring Boot2 cheat sheet
Spring Boot exception handling
Spring boot development-development environment-
Spring Boot learning procedure
Use Interceptor in Spring
Learning Spring Boot [Beginning]
Spring boot memo writing (2)
Spring Boot 2.2 Document Summary
[Spring Boot] DataSourceProperties $ DataSourceBeanCreationException
Spring Boot 2.3 Application Availability
Spring boot tutorials Topics
Download with Spring Boot
How to use CommandLineRunner in Spring Batch of Spring Boot
File upload with Spring Boot (do not use Multipart File)
[Spring Boot] Environment construction (macOS)
Set context-param in Spring Boot
Try Spring Boot from 0 to 100.
Generate barcode with Spring Boot
Hello World with Spring Boot
Implement GraphQL with Spring Boot
Spring Boot tutorial task schedule
Spring 5 & Spring Boot 2 Hands-on preparation procedure
Get started with Spring boot
[spring] Let's use Spring Data JPA
Hello World with Spring Boot!
Spring Boot 2 multi-project in Gradle
[Spring Boot] Web application creation
spring boot port duplication problem
Spring Boot Hot Swapping settings
[Java] Thymeleaf Basic (Spring Boot)
Introduction to Spring Boot ① ~ DI ~
File upload with Spring Boot
Spring Boot starting with copy
Introduction to Spring Boot ② ~ AOP ~
How to call and use API in Java (Spring Boot)
Spring Boot starting with Docker
Spring Boot DB related tips
Hello World with Spring Boot
Set cookies with Spring Boot
[Spring Boot] Easy paging recipe