本文共 2665 字,大约阅读时间需要 8 分钟。
一、介绍:
springboot是由Pivotal团队开发,其设计目的就是尽可能的简化spring搭建框架和启动过程,或者说所有的配置都是一种开关模式配置,需要就配置不需要就可以不配置,极大的简化配置方面复杂内容,springboot目前的市场占有率非常高
二、特点:
1、快速搭建 web服务
2、无需打包war包,即可运行服务,内嵌tomcat
3、简化依赖jar包配置,只需引入springboot指定jar即可将相关依赖都自动引入,简化maven配置
4、spring容器自动构建和装载
5、无xml任何配置
三、优点:
springboot支持快速开发restful接口,作为服务存在,无需其他繁琐xml配置文件,运行jar文件即可,自动化方便,适合做微服务,在设计里面横向扩展非常方便,也适合大型项目的链式开发,模块切分,可以做微服务的分布式架构,当然在其他方面的插件集成也是非常方便的,比如:redis ,mongodb,cache,mybaties等等技术框架
四、快速搭建实例代码:
pom.xml
HelloWordController.java 访问地址代码4.0.0 spring-boot-helloword spring-boot-helloword 0.0.1-SNAPSHOT e生态,互联网知识分享 org.springframework.boot spring-boot-starter-parent 1.3.2.RELEASE UTF-8 1.8 org.springframework.boot spring-boot-starter org.springframework.boot spring-boot-starter-test test org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-maven-plugin
/** * @Title: HelloWordController.java * @Package com.eshengtai.controller * Copyright: Copyright (c) 2015 * @author: e生态 ,www.eshengtai.net * @date: 2017年5月9日 上午8:29:16 * */package com.eshengtai.controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;@RestController@RequestMapping("eshengtai")public class HelloWordController { /** * e生态 欢迎您~ * * @Title: welcome * @return * */ @RequestMapping("welcome") public String welcome() { return "HelloWord!,欢迎来到《e生态》互联网技术分享平台~~~~"; }}
启动spring boot程序 Application.java
package com.eshengtai;import org.springframework.boot.SpringApplication;import org.springframework.boot.autoconfigure.SpringBootApplication;/** * * @author e生态 * @version 1.0.0 * @blog http://www.eshengtai.net * */@SpringBootApplicationpublic class Application { public static void main(String[] args) { SpringApplication.run(Application.class, args); }}项目结构图
项目启动图
项目访问地址返回结果图