什么是SpringBoot简介
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.优缺点
---------------------------第⼆种认识-------------------------
现在的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.1Java 7+
Tomcat 7 3.0Java 6+
engine什么意思Jetty 9 3.1Java 7+
Jetty 8 3.0Java 6+
Undertow 1.13.1Java 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.
Name Description
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.
发布评论