스프링부트는 사용하지만 웹서버는 띄우고 싶지 않다.
by Sunkyung
스프링부트는 웹서버가 아니다.
스프링부트는 웹서버가 아니다. 단지 디폴트 내장서버로 톰캣을 사용하고 있을 뿐이다.
compile('org.springframework.boot:spring-boot-starter-web')
Web Starter를 추가하면 특별한 설정없이 내장 서버 톰캣을 사용하게 된다.
만약 서버만 사용하고 싶지 않다면? 설정에서 WebApplicationType을 NONE으로 설정해 주면 된다.
@SpringBootApplication
public class SpringStudyApplication {
public static void main(String[] args) {
SpringApplication springApplication = new SpringApplication(Application.class);
springApplication.setWebApplicationType(WebApplicationType.NONE);
}
}
혹은 properties 설정을 통해서도 작성할 수 있다.
spring.main.web-application-type=none
이렇게 하면 Web서버를 띄우지 않는다.
추가로 톰캣이 아닌 Jetty와 같은 다른 서버를 사용하고 싶다면 ?
compile('org.springframework.boot:spring-boot-starter-web') {
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
}
톰캣 의존성을 제외시키고 다른 서버를 추가해주면 되겠다.
Subscribe via RSS