Notice
Recent Posts
Recent Comments
Link
«   2025/06   »
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
Archives
Today
Total
관리 메뉴

JAVA Developer Training

44. Spring 배포 패키징 본문

트레이닝

44. Spring 배포 패키징

Romenest 2021. 10. 8. 17:25

pom.xml

<!-- 배포용 WAS tomcat -->
      <dependency>
         <groupId>org.springframework.boot</groupId>
         <artifactId>spring-boot-starter-tomcat</artifactId>
         <scope>provided</scope>
      </dependency>

디펜던시 추가

 

application.java

@SpringBootApplication
@PropertySource("classpath:global.properties")
@ComponentScan(basePackages = { "com.example.controller", "com.example.restcontroller", "com.example.security","com.example.jwt" })
@EntityScan(basePackages = { "com.example.entity" })
@EnableJpaRepositories(basePackages = { "com.example.repository" })
public class Boot20210914Application extends SpringBootServletInitializer {
	public static void main(String[] args) {
		SpringApplication.run(Boot20210914Application.class, args);
		System.out.println("start server");
	}

	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
		// TODO Auto-generated method stub
		return builder.sources(Boot20210914Application.class);
	}
	
}

1. SpringBootServletInitializer 상속 

2. configure 오버라이드

3. return builder.sources(실행파일 - 여기서는Boot20210914Application.class 가 되겠다)

 

 

이후 좌측 목록에서 Maven 클릭

 

패키지 클릭

 

 

이후 패키징된 파일은 target폴더에 만들어진다