| 일 | 월 | 화 | 수 | 목 | 금 | 토 | 
|---|---|---|---|---|---|---|
| 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 | 
                            Tags
                            
                        
                          
                          - postgres install
 - taskkill
 - svn 특정 리비전 사이 추출
 - svn dump
 - Store password unencrypted
 - svn 사용법
 - 포스트그레스 설치
 - svn update
 - expected at least 1 bean which qualifies as autowire candidate
 - apt-get update 오류
 - svn commit
 - Oracle install
 - ant
 - grep
 - docker 폐쇄망
 - mysql dml
 - svn 변경된 파일 추출
 - NEXUS
 - svn log
 - svn load
 - 프로젝트 네임변경 후 이클립스 로딩시 에러
 - Cannot prepare internal mirrorlist: No URLs in mirrorlist
 - WH question
 - Failed to download metadata for repo 'appstream'
 - VirtualBox
 - svn
 - docker oracle12c
 - xrdp
 - Remmina
 - javax.servlet.GenericFilter
 
                            Archives
                            
                        
                          
                          - Today
 
- Total
 
기억의 습작
jar 패키지로 생성된 spring boot 프로젝트를 war 패키지로 변경 본문
- 본 예제는 gradle 기준입니다.
- 출력된 war 파일은 외부 was에서 잘 동작합니다.
- 외장 tomcat 구동 오류시 참조링크 확인하세요.
jar 패키지로 생성된 Spring boot 프로젝트는 다음과 같이 main문이 있다.
| 
 1 
2 
3 
4 
5 
6 
7 
 | 
 @SpringBootApplication 
public class SampleApplication { 
    public static void main(String[] args) { 
        SpringApplication.run(SampleApplication.class, args); 
    } 
} 
 | 
|
위 부분을 아래와 같이 수정한다
| 
 1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
 | 
 @SpringBootApplication 
public class SampleApplication extends SpringBootServletInitializer { 
    public static void main(String[] args) { 
        SpringApplication.run(SampleApplication.class, args); 
    } 
    @Override 
    protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) { 
        return builder.sources(SampleApplication.class); 
    } 
} 
 | 
|
추가로 gradlebuild.gradle 파일의 기본은 다음과 같습니다.
| 
 1 
2 
3 
4 
5 
6 
7 
8 
9 
10 
11 
12 
13 
14 
15 
16 
17 
18 
19 
20 
21 
22 
23 
24 
 | 
 plugins { 
    id 'org.springframework.boot' version '2.1.7.RELEASE' 
    id 'io.spring.dependency-management' version '1.0.7.RELEASE' 
    id 'java' 
} 
group = 'com.ppusari' 
version = '0.0.1-SNAPSHOT' 
sourceCompatibility = '1.8' 
repositories { 
    mavenCentral() 
} 
dependencies { 
    implementation 'org.springframework.boot:spring-boot-starter-web' 
    testImplementation 'org.springframework.boot:spring-boot-starter-test' 
} 
jar { 
    manifest { 
        attributes 'Main-Class': 'com.ppusari.sample.SampleApplication' 
    } 
} 
 | 
|
아래와 같이 수정을 합니다.
| 
 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 
31 
32 
33 
 | 
 plugins { 
    id 'org.springframework.boot' version '2.1.7.RELEASE' 
    id 'io.spring.dependency-management' version '1.0.7.RELEASE' 
//주석    id 'java' 
//추가1  
    id 'war' 
    id 'application'     
} 
group = 'com.ppusari' 
version = '0.0.1-SNAPSHOT' 
sourceCompatibility = '1.8' 
// 추가2 (main문이 있는 path) 
mainClassName="com.ppusari.sample.SampleApplication" 
repositories { 
    mavenCentral() 
} 
dependencies { 
    implementation 'org.springframework.boot:spring-boot-starter-web' 
    testImplementation 'org.springframework.boot:spring-boot-starter-test' 
} 
jar { 
    manifest { 
        attributes 'Main-Class': 'com.ppusari.sample.SampleApplication'         
    } 
} 
 | 
|
728x90
    
    
  반응형
    
    
    
  LIST
    'Software > Spring' 카테고리의 다른 글
| spring boot 실행시 profile 적용하기 (0) | 2021.08.26 | 
|---|---|
| expected at least 1 bean which qualifies as autowire candidate (0) | 2019.09.07 | 
| 기 생성된 DB 테이블을 자동으로 Entity 객체를 생성해 주면서 Queryfactory 객체까지 추가로 생성 (0) | 2019.09.01 | 
| spring boot 를 war로 출력하여 tomcat 서버에 올렸을 때 발생되는 오류 (0) | 2019.08.31 |