什么是Spring Boot简介
1.什么是spring boot
简单的说,spring boot就是整合了很多优秀的框架,不用我们自己手动的去写一堆xml配置然后进行配置。
从本质上来说,Spring Boot就是Spring,它做了那些没有它你也会去做的Spring Bean配置。它使用“习惯优于配置”(项目中存在大量的配置,此外还内置了一个习惯性的配置,让你无需手动进行配置)的理念让你的项目快速运行起来。使 用Spring Boot很容易创建一个独立运行(运行jar,内嵌Servlet容器)、准生产级别的基于Spring框架的项目,使用Spring Boot你可以不用或者只需要很少的Spring配置。
Spring Boot精要
Spring将很多魔法带入了Spring应用程序的开发之中,其中最重要的是以下四个核心。
- 自动配置:针对很多Spring应用程序常见的应用功能,Spring Boot能自动提供相关配置
- 起步依赖:告诉Spring Boot需要什么功能,它就能引入需要的库。
- 命令行界面:这是Spring Boot的可选特性,借此你只需写代码就能完成完整的应用程序,无需传统项目构建。
- Actuator:让你能够深入运行中的Spring Boot应用程序,一探究竟。
动态语言:不需要编译,直接运行,比如JS。
静态语言:先编译再运行。
配置指的是xml配置,低下的开发效率指的是编写完代码之后需要进行大量的xml配置,但是单从写代码而言,Java开发效率还是比较高的,因为有许多写好的第三方jar包。
微服务:将子系统拆成一个一个的jar包运行就是微服务。
2.优缺点
---------------------------第二种认识-------------------------
1 . springboot简单介绍(http://projects.spring.io/spring-boot/)
现在的web项目几乎都会用到spring框架,而要使用spring难免需要配置大量的xml配置文件,而 springboot的出现解 决了这一问题,一个项目甚至不用部署到服务器上直接开跑,真像springboot所说:“just run”。
springboot的很多默认编码方式都是utf-8,真是福利啊。
org.spring 2013年新开发的框架springboot , 它让一个单独项目的创建变得更加的简单,让所有依赖spring的程序可以做到“just run”。springboot提供大量第三方libraries让我们可以非常轻松的开始创建一个spring工程,甚至不需要再去配置一些繁琐的 xml配置文件
框架特点:
1:创建独立的spring应用。
2:嵌入Tomcat, Jetty Undertow 而且不需要部署他们。
3:提供的“starters”poms来简化Maven配置
4:尽可能自动配置spring应用。
5:提供生产指标,健壮检查和外部化配置
6:绝对没有代码生成和XML配置要求
2.SpringBoot运行环境
Spring Boot最新版可以运行在Java6+的环境下,但是Spring官方建议使用Java8。
Servlet 容器
Name | Servlet Version | Java Version |
---|---|---|
Tomcat 8 | 3.1 | Java 7+ |
Tomcat 7 | 3.0 | Java 6+ |
Jetty 9 | 3.1 | Java 7+ |
Jetty 8 | 3.0 | Java 6+ |
Undertow 1.1 | 3.1 | Java 7+ |
3.pringBoot支持哪些应用
使用SpringBoot可以快速创建普通Java项目和Web项目,以及其他项目。
Spring Boot application starters
Name | Description |
---|---|
spring-boot-starter |
The core Spring Boot starter, including auto-configuration support, logging and YAML. |
spring-boot-starter-actuator |
Production ready features to help you monitor and manage your application. |
spring-boot-starter-amqp |
Support for the “Advanced Message Queuing Protocol” via spring-rabbit. |
spring-boot-starter-aop |
Support for aspect-oriented programming including spring-aop and AspectJ. |
spring-boot-starter-artemis |
Support for “Java Message Service API” via Apache Artemis. |
spring-boot-starter-batch |
Support for “Spring Batch” including HSQLDB database. |
spring-boot-starter-cache |
Support for Spring’s Cache abstraction. |
spring-boot-starter-cloud-connectors |
Support for “Spring Cloud Connectors” which simplifies connecting to services in cloud platforms like Cloud Foundry and Heroku. |
spring-boot-starter-data-elasticsearch |
Support for the Elasticsearch search and analytics engine including spring-data-elasticsearch. |
spring-boot-starter-data-gemfire |
Support for the GemFire distributed data store including spring-data-gemfire. |
spring-boot-starter-data-jpa |
Support for the “Java Persistence API” including spring-data-jpa, spring-orm and Hibernate. |
spring-boot-starter-data-mongodb |
Support for the MongoDB NoSQL Database, including spring-data-mongodb. |
spring-boot-starter-data-redis |
Support for the REDIS key-value data store, including spring-data-redis. |
spring-boot-starter-data-rest |
Support for exposing Spring Data repositories over REST via spring-data-rest-webmvc. |
spring-boot-starter-data-solr |
Support for the Apache Solr search platform, including spring-data-solr. |
spring-boot-starter-freemarker |
Support for the FreeMarker templating engine. |
spring-boot-starter-groovy-templates |
Support for the Groovy templating engine. |
spring-boot-starter-hateoas |
Support for HATEOAS-based RESTful services via spring-hateoas. |
spring-boot-starter-hornetq |
Support for “Java Message Service API” via HornetQ. |
spring-boot-starter-integration |
Support for common spring-integration modules. |
spring-boot-starter-jdbc |
Support for JDBC databases. |
spring-boot-starter-jersey |
Support for the Jersey RESTful Web Services framework. |
spring-boot-starter-jta-atomikos |
Support for JTA distributed transactions via Atomikos. |
spring-boot-starter-jta-bitronix |
Support for JTA distributed transactions via Bitronix. |
spring-boot-starter-mail |
Support for javax.mail. |
spring-boot-starter-mobile |
Support for spring-mobile. |
spring-boot-starter-mustache |
Support for the Mustache templating engine. |
spring-boot-starter-security |
Support for spring-security. |
spring-boot-starter-social-facebook |
Support for spring-social-facebook. |
spring-boot-starter-social-linkedin |
Support for spring-social-linkedin. |
spring-boot-starter-social-twitter |
Support for spring-social-twitter. |
spring-boot-starter-test |
Support for common test dependencies, including JUnit, Hamcrest and Mockito along with the spring-testmodule. |
spring-boot-starter-thymeleaf |
Support for the Thymeleaf templating engine, including integration with Spring. |
spring-boot-starter-velocity |
Support for the Velocity templating engine. |
spring-boot-starter-web |
Support for full-stack web development, including Tomcat and spring-webmvc. |
spring-boot-starter-websocket |
Support for WebSocket development. |
spring-boot-starter-ws |
Support for Spring Web Services. |