本文共 964 字,大约阅读时间需要 3 分钟。
Spring Boot来简化Spring应用开发,约定大于配置,去繁从简, just run就能创建一个独立的,产品级别的应用;
背景:J2EE笨重的开发、繁多的配置、低下的开发效率、复杂的部署流程、第三方技术集成难度大。 解决:"Spring全家桶”时代。Spring Boot→J2EE-站式解决方案、Spring Cloud→分布式整体解决方案;1.创建一个maven工程,导入spring boot相关的依赖:
org.springframework.boot spring-boot-starter-parent 1.5.9.RELEASE org.springframework.boot spring-boot-starter-web
2.编写一个主程序;启动Spring Boot应用:
@SpringBootApplication/** * @SpringBootApplication 来标注一个主程序类,说明这是一个Spring Boot应用 */public class SpringBootMain { public static void main(String[] args) { SpringApplication.run(SpringBootMain.class,args); }}
3.编写Controller层:
@Controllerpublic class SpringController { @RequestMapping("/select") @ResponseBody public String index(){ return "我的第一个Springboot项目"; }}
4、运行主程序测试
转载地址:http://rlqzi.baihongyu.com/