JAVA Developer Training
44. Spring 배포 패키징 본문
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폴더에 만들어진다
'트레이닝' 카테고리의 다른 글
46. SQL문 (기초, 권한부여, 테이블생성,수정,삭제) (0) | 2021.10.12 |
---|---|
45. 우분투 원격접속 (0) | 2021.10.12 |
43. Spring (게시판과정 정리 - 템플릿 - 4) (0) | 2021.10.08 |
42. Spring ( 게시판 과정 정리 - 컨트롤러 - 3 ) (0) | 2021.10.08 |
41. Spring ( 게시판 과정정리 - 엔티티,저장소 - 2 ) (0) | 2021.10.08 |