视频代码下载地址:javacto.taobao.com
开发步骤:
1.创建Maven工程
此处选择打包方式jar
第二步:修改pom.xml配置文件
<!-- 引用springBoot父类依赖 -->
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.4.1.RELEASE</version>
</parent>
<!-- SpringBoot-web组件 -->
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies>
第三步创建 HelloContoller
@RestController
public class HelloContoller {
@RequestMapping("/hello")
public String hello(){
return "hello SpringBoot";
}
@RequestMapping("/retJson")
public JavaCto returnJson(){
JavaCto cto = new JavaCto();
cto.setId(1);
cto.setName("javacto.taobao.com");
return cto;
}
}
第四步创建PO:
第五步创建App
第六步:运行App启动 , 启动有两种方式,访问
http://localhost:8080/retJson
视频代码下载地址:javacto.taobao.com
SpringBoot
1.敏捷开发(整合框架)
2.无需Tomcat(java应用程序运行,实际jar包,内置Tomcat)
3.减少xml配置(没有xml)
4.注解开发