Post

Backend - Spring Boot WAR 톰켓 설정 방법

1.pom.xml에서 내장 톰켓 의존성 제거

1
2
3
4
5
6
7
8
9
10
11
<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>

2.Application 클래스에서 SpringBootServletInitializer 클래스를 상속받아 configure 메서드 구현

1
2
3
4
5
6
7
8
@SpringBootApplication
public class UsersampleApplication extends SpringBootServletInitializer {

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
		return builder.sources(UsersampleApplication.class);
	}
}
This post is licensed under CC BY 4.0 by the author.