Spring Boot 01

官网:http://projects.spring.io/spring-boot/
1.配置pom.xml

xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
com.example
myproject
0.0.1-SNAPSHOT

org.springframework.boot
spring-boot-starter-parent
1.4.0.RELEASE



org.springframework.boot
spring-boot-starter-web



2.写Hellow World


@SpringBootApplication
@RestController
public class Application {

@RequestMapping("/")
public String greeting() {
    return "Hello World!";
}

public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
}

}

3.运行
由于我们使用了 spring-boot-starter-parent POM,所以可以使用 mvn spring-boot:run 启动



org.springframework.boot
spring-boot-maven-plugin



mvn package,打包jar到/target目录下

java -jar target/myproject-0.0.1-SNAPSHOT.jar 运行jar

你可能感兴趣的:(Spring Boot 01)