1. Eclipse 설치
1.1. https://eclipse.org/ 에서 다운로드 한다

1.2 Eclipse IDE for Java EE Developers 를 설치 한다



2. STS Plug-in 설치
2.1. http://dist.springsource.com/release/TOOLS/update/e4.6/ Location으로 설치하자





3. Spring 프로젝트 생성
3.1. File - New - Other 를 클릭한다

3.2. Spring Starter Project 를 선택한다

3.3. 원하는 정보를 입력 한다 ( 아직 Gradle에 익숙하지 않아서 그냥 Maven으로 선택)

3.4. 많은 옵션들이 존재한다. 향후에 필요한 옵선을 선택하도록 하고 기본적으로 Web 만 선택한다

3.5. Spring 사이트에 접속해서 프로젝트 소스를 만들어 가져오는 것 같다. 그냥 Finish 를 클릭하자

3.6. 생성된 구조이다. 이제 Spring 4를 사용하여 개발 하면 된다

4. Spring Boot 프로젝트를 War 생성하여 외부 Tomcat에 Deploy 하기
- (참고) Spring Boot 는 기본적으로 내부 Tomcat이 들어가 있다. Run As - Spring Boot App 를 클릭하면 단독으로 실행된다

4.1. 자신이 명명한 Application 클래스를 아래와 같이 수정한다 (붉은 색으로 되어 있는 글자)

package com.example;
import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.support.SpringBootServletInitializer;
@SpringBootApplication public class Spring4ProjectApplication extends SpringBootServletInitializer{ public static void main(String[] args) { SpringApplication.run(Spring4ProjectApplication.class, args); }
@Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(Spring4ProjectApplication.class); } } |
4.2. pom.xml 을 아래와 같이 수정한다 (붉은 색으로 되어 있는 글자)
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>com.example</groupId> <artifactId>demo</artifactId> <version>0.0.1-SNAPSHOT</version> <packaging>war</packaging>
<name>Spring4Project</name> <description>Demo project for Spring Boot</description> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.4.1.RELEASE</version> <relativePath/> <!-- lookup parent from repository --> </parent>
<properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <java.version>1.8</java.version> </properties>
<dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency>
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency>
<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> </dependencies>
<build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> </plugins> </build>
</project> |
4.3. 저장 이후에는 에러가 나온다. Maven - Update Project 를 클릭 하자


4.4. Server에 Deploy 하기 위하여 먼저 작업 할 것이 있다. 바로 Cloud Foundry Standalone Application 를 해제 해야 된다는 것이다


4.5. Server 생성하여 Deploy 하자




4.6. 이제 완료 되었다. Spring Boot 개발은 아래 링크를 참조하자
- http://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/