建议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>
</dependencies>
hello/SampleController.java
package hello;
import org.springframework.boot.*;
import org.springframework.boot.autoconfigure.*;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;
@Controller
@EnableAutoConfiguration
public class SampleController {
@RequestMapping("/")
@ResponseBody
String home() {
return "Spring Boot视频教程大全/java视频教程大全www.it448.com";
}
public static void main(String[] args) throws Exception {
SpringApplication.run(SampleController.class, args);
}
}
启动main方法!一个 Spring Boot入门示例就这么简单。