Spring Boot 1 險ュ螳

SpringBoot縺ィ縺ッ

Spring繝輔Ξ繝シ繝繝ッ繝シ繧ッ縺ョ邁。譏鍋沿

險ュ螳

Eclipse

繝励Λ繧ー繧、繝ウ
Spring Tool Suite (STS) for Eclipse X.X.X
繧偵槭シ繧ア繝繝医励Ξ繧、繧ケ縺九i繧、繝ウ繧ケ繝医シ繝ォ

繝励Ο繧ク繧ァ繧ッ繝

繝サSpring > Spring Starter Project
繝サMaven > Maven Project

pom.xml(Spring-Boot逕ィ)

<project >
縲<artifactId>ス</artifactId>
騾壼クク
縲<packaging>jar</packaging>
繧「繝励Μ繧ア繝シ繧キ繝ァ繝ウ繧オ繝シ繝舌∈繝繝励Ο繧、縺吶k蝣エ蜷
縲<packaging>war</packaging>

Spring-Boot逕ィpom.xml繧堤カ呎価
縲<parent>
縲縲<groupId>org.springframework.boot</groupId>
縲縲<artifactId>spring-boot-starter-parent</artifactId>
縲縲<version>1.5.3.RELEASE</version>
縲縲<relativePath/>
縲</parent>
縲<dependencies>
縲縲Web繧「繝励Μ繧ア繝シ繧キ繝ァ繝ウ逕ィ繝ゥ繧、繝悶Λ繝ェ
縲縲<dependency>
縲縲縲<groupId>org.springframework.boot</groupId>
縲縲縲<artifactId>spring-boot-starter</artifactId>
縲縲</dependency>
縲縲Spring-Boot繝繧ケ繝育畑繝ゥ繧、繝悶Λ繝ェ
縲縲JUnit縺ッ荳崎ヲ
縲縲<dependency>
縲縲縲<groupId>org.springframework.boot</groupId>
縲縲縲<artifactId>spring-boot-starter-test</artifactId>
縲縲縲<scope>test</scope>
縲縲</dependency>
縲</dependencies>
縲<build>
縲縲<plugins>
縲縲縲Spring-Boot繝励Ο繧ク繧ァ繧ッ繝医rMaven縺ァ謫堺ス懊☆繧狗ぜ縺ョ繝励Λ繧ー繧、繝ウ
縲縲縲<plugin>
縲縲縲縲<groupId>org.springframework.boot</groupId>
縲縲縲縲<artifactId>spring-boot-maven-plugin</artifactId>
縲縲縲</plugin>
縲縲</plugins>
縲</build>
</project>

襍キ蜍

繝励Ο繧ク繧ァ繧ッ繝医r蜿ウ繧ッ繝ェ繝繧ッ > 繝繝舌ャ繧ー(螳溯。) > SpringBootApp
http://localhost:8080/test/

繧ウ繝シ繝

@SpringBootApplication
@RestController
public class App extends SpringBootServletInitializer
{
縲public static void main( String[] args )
縲{
縲縲SpringApplication.run(App.class, args);
縲}
縲@Override
縲protected SpringApplicationBuilder configure(SpringApplicationBuilder application){
縲縲return application.sources(App.class);
縲}
縲@RequestMapping(value="test", method=RequestMethod.GET)
縲public String getValue(){
縲縲return "yone@office-yone.com";
縲}
}

Follow me!

蜑阪ョ險倅コ

Gradle 菴ソ逕ィ譁ケ豕