Spring

[Spring] Swagger

quedevel 2020. 3. 12. 17:10
728x90
반응형
		<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger-ui -->
		<dependency>
			<groupId>io.springfox</groupId>
			<artifactId>springfox-swagger-ui</artifactId>
			<version>2.9.2</version>
		</dependency>

		<!-- https://mvnrepository.com/artifact/io.springfox/springfox-swagger2 -->
		<dependency>
			<groupId>io.springfox</groupId>
			<artifactId>springfox-swagger2</artifactId>
			<version>2.9.2</version>
		</dependency>

pom.xml 에 추가

Swagger는 설정이 필요

SwaggerConfig.java

@Configuration
@EnableSwagger2
public class SwaggerConfig {

    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .select()
                .apis(RequestHandlerSelectors.any()) 
                .paths(PathSelectors.ant("/**")) 
                .build();
    }
}

 

Swagger URL : http://localhost:8080/swagger-ui.html

 

728x90
반응형

'Spring' 카테고리의 다른 글

[Spring] Page<?> 객체에 있는 page 정보들 다루기  (0) 2020.03.13
[Spring] Thymeleaf를 이용해 데이터 다루기  (0) 2020.03.13
[Spring] Mustache  (0) 2020.03.12
[Spring] Thymeleaf 문법  (0) 2020.03.11
[Spring] Thymeleaf  (0) 2020.03.10