环境要求
- 开发环境JDK 1.8
- 项目管理工具( Maven )
- 开发工具(Eclipse/idea)
创建Maven项目
SpringMVC支持
导包
<parent> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.0.5.RELEASE</version>
</parent>
<dependencyManagement>
<dependencies>
<!--springboot版本管理-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>2.0.5.RELEASE</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
-
新建一个在导包
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
@SpringBootApplication
public class SpringMVCAppTest {
public static void main(String[] args) {
SpringApplication.run(SpringMVCAppTest.class);
}
}
@RestController
public class HelloController {
@RequestMapping("/hello")
public String test(){
return "嗨~!";
}
}
网友评论