Spring Boot는 무엇인가?
Server내에서 독립적인 Spring Application을 비교적 간단한 설정 만으로 구동가능하게 해주는 구성 프레임웍이다.
간단한 Boot 예제
목표 : Browser에서 hello JeongHoon, Kim 확인.
git repository 생성
$ git init
Initialized empty Git repository in D:/springboot-note/GettingStart/.git/
Maven을 이용한 프로젝트 생성
mvn -B archetype:generate -DarchetypeGroupId=org.apache.maven.archetypes -DgroupId=com.test.app -DartifactId=my-test
Hello.java 생성
package com.test.app;
import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;
@RestController
@EnableAutoConfiguration
public class Example {
@RequestMapping("/")
String home() {
return "Hello JeongHoon, Kim";
}
public static void main(String[] args) throws Exception {
SpringApplication.run(Example.class, args);
}
}
pom.xml에 spring boot 관련 내용 추가
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
Spring Boot 실행
$ mvn spring-boot:run
Page 확인
http://localhost:8080/
'기타-프로그래밍' 카테고리의 다른 글
MADP EMM 개념 정리 (0) | 2018.01.25 |
---|---|
Mobile Acronym 모바일 두문자어 (0) | 2018.01.22 |
GCP Putty 연결하기 (0) | 2018.01.19 |
Spring Boot를 이용한 Spring Security 시작 하기 (0) | 2018.01.16 |
NoSuchElementException (0) | 2008.03.03 |