일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
- 여성패션
- 쿠팡리뷰분석
- 싱글라이프
- 쿠팡 리뷰 모아보기
- 건강/의료용품
- 바지/레깅스
- 황사마스크
- 겨울용품관
- 장갑/시즌잡화
- 메이크업
- 쿠팡 리뷰 분석
- 패션마스크
- 쿠팡리뷰
- 스킨케어
- 쿠팡 리뷰
- 선물관
- 파닥이
- 신발
- 뷰티
- 바지
- 생활용품
- 2020 설날
- 쿠팡 브랜드
- 스포츠/레저
- 자동차용품
- 가방/잡화
- 아이 메이크업
- 건강식품
- 식품
- 마스크/방한대
- Today
- Total
파닥이
[REST API] Swagger 본문
공식사이트 : swagger
1. swagger 라이브러리 추가 (gradle) (swagger를 사용시 jackson 라이브러리도 같이 쓰임)
compile group: 'io.springfox', name: 'springfox-swagger2', version: '2.5.0'
compile group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.5.0'
2. SwaggerConfiguration 생성
//Swagger 2.0 version을 사용 annotation
@EnableSwagger2
//설정 파일 annotation
@Configuration
public class SwaggerConfiguration {
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.select()
.apis(RequestHandlerSelectors.basePackage("com.test.filter"))
.paths(PathSelectors.any())
.build();
}
}
3. servlet-context.xml 추가
<default-servlet-handler />
<resources location="classpath:/META-INF/resources/" mapping="/swagger-ui.html"></resources>
<resources location="classpath:/META-INF/resources/webjars/" mapping="/webjars/**"></resources>
4. AOP를 사용할경우 제외
<mvc:exclude-mapping path="/swagger-ui.html" />
<mvc:exclude-mapping path="/webjars/**" />
<mvc:exclude-mapping path="/swagger-resources/**" />
<mvc:exclude-mapping path="/v2/**" />
5. /swagger-ui.html 경로로 접속
참조 블로그
https://medium.com/@jjeaby/swagger-with-spring-java-ccb8bd9371e0
'IT > Spring' 카테고리의 다른 글
[spring] @RequestMapping 정리 (0) | 2019.03.25 |
---|---|
[tomcat] server.xml설정으로 데이터 압축 (0) | 2019.03.19 |
[spring] ajax에서 객체배열 파라미터 보내기 (0) | 2019.03.07 |
[spring] spring properties 설정 정리 (0) | 2018.12.10 |
[spring] AspectJ의 Pointcut 표현식 (0) | 2018.12.08 |