前言
Spring Boot makes it easy to create stand-alone, production-grade Spring-based Applications that you can run. We take an opinionated view of the Spring platform and third-party libraries, so that you can get started with minimum fuss. Most Spring Boot applications need very little Spring configuration.
Our primary goals are:
● Provide a radically faster and widely accessible getting-started experience for all Spring development.
● Be opinionated out of the box but get out of the way quickly as requirements start to diverge from the defaults.
● Provide a range of non-functional features that are common to large classes of projects (such as embedded servers, security, metrics, health checks, and externalized configuration).
● Absolutely no code generation and no requirement for XML configuration.
1.生成项目结构
2.POM中添加web依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
3.编写controller
@RestController
@SpringBootApplication
public class DemoApplication {
@RequestMapping("/")
String home() {
return "Hello World";
}
public static void main(String[] args) {
SpringApplication.run(DemoApplication.class, args);
}
}
直接运行当前controller类
网友评论