Spring Boot 외장 톰캣 연동

Spring Boot는 기본적으로 내장 톰캣을 지원한다. 
다음은 내장 톰캣이 아닌 외장 톰캣을 사용하는 방법이다.

1) 톰캣 설치 후 서비스 등록/실행

2) pom.xml 설정
* dependency 추가 
1
2
3
4
5
  <dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-tomcat</artifactId>
    <scope>provided</scope>
  </dependency>
cs


* WAR 패키징 (jar->war)

3) Initialize 추가

SpringBootServletInitializer를 상속 받아 SpringApplicationBuiler 메소드를 오버라이딩 해준다.

1
2
3
4
5
6
7
8
public class AppInitializer extends SpringBootServletInitializer {
 
  @Override
  protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(Application.class);
  }
 
}
cs

4) 톰캣경로\conf\server.xml 수

<Host name="localhost"  appBase="프로젝트 경로"
         unpackWARs="true" autoDeploy="true"
         xmlValidation="false" xmlNamespaceAware="false">

5) 톰캣경로\bin\tomcat7w.exe 실행 -> Start


'Development > SpringBoot' 카테고리의 다른 글

Spring Boot 에러페이지 설정  (0) 2016.05.18
Spring / Spring Boot 설정 비교  (0) 2016.05.15
Spring Boot 소개  (0) 2016.04.17

+ Recent posts