티스토리 뷰

Tomcat 실행이 체감상 느려서 Jetty로 바꾸어보았습니다. 그랬더니 조금 빨라졌습니다.

 

Jetty로 대체

dependencies {
    implementation('org.springframework.boot:spring-boot-starter-web') {
        exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
    }
    implementation "org.springframework.boot:spring-boot-starter-jetty"
}

잘 적용 되었다면 아래와 같이 나옵니다.

 

Maven

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-web</artifactId>
    <exclusions>
        <exclusion>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-tomcat</artifactId>
        </exclusion>
    </exclusions>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-jetty</artifactId>
</dependency>

 

Swagger연동

 

버젼은 swagger2 2.9.2를 사용 했습니다.

 

build.gradle

dependencies {
    implementation 'io.springfox:springfox-swagger2:2.9.2'
    implementation group: 'io.springfox', name: 'springfox-swagger-ui', version: '2.9.2'
}

 

 

application.yml

이 설정은 SpringBoot 2.6 이상에서 Dependency에러가 나는 경우 추가 해주시기 바랍니다.

spring:
  mvc:
    pathmatch:
      matching-strategy: ant_path_matcher

 

config/Swagger2Configuration.java

@Configuration
@EnableSwagger2
public class Swagger2Configuration{

    @Bean
    public Docket api() {
        return new Docket(DocumentationType.SWAGGER_2)
                .useDefaultResponseMessages(false)
                .select()
                .apis(RequestHandlerSelectors.basePackage("com.kafka.kafkapubsubjava"))
                .paths(PathSelectors.any())
                .build()
                .apiInfo(apiInfo());
    }

    private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("Practice Swagger")
                .description("practice swagger config")
                .version("1.0")
                .build();
    }

}
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2024/04   »
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
글 보관함