Spring Boot (基础篇):Spring Boot知识点总结

版权声明:本博客所有内容采用 知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议 进行许可 https://blog.csdn.net/Soinice/article/details/82387775

Spring Boot简介

  • SpringBoot 以便捷开发、快速部署著称。设计目的是用来简化新Spring应用的初始搭建以及开发过程。
  • SpringBoot 致力于简洁,让开发者写更少的配置,程序能够更快的运行和启动
  • SpringBoot 设计原则就是 约定优于配置。并且内嵌了Servlet容器
  • SpringBoot 采用的是Java Config的方式,对Spring进行配置,避免了XML配置以及复杂的依赖管理,使用springboot可以帮助开发者快速搭建一个Spring框架
  • SpringBoot 封装了各种组件,使用那个就引入依赖模块即可
  • SpringBoot 使用了特定的方式来进行配置,从而使开发人员不再需要定义样板化的配置。
  • SpringBoot 可以以jar包的形式来运行,运行一个Spring Boot项目我们只需要通过Java -jar xx.jar类运行。
  • SpringBoot 可以内嵌Tomcat,这样我们无需以war包的形式部署项目,非常方便。

Spring Boot启动器

  1)spring-boot-starter         这是Spring Boot的核心启动器,包含了自动配置、日志和YAML。
  2)spring-boot-starter-actuator     帮助监控和管理应用。
  3)spring-boot-starter-amqp      通过spring-rabbit来支持AMQP协议(Advanced Message Queuing Protocol)。
  4)spring-boot-starter-aop            支持面向方面的编程即AOP,包括spring-aop和AspectJ。
  5)spring-boot-starter-artemis      通过Apache Artemis支持JMS的API(Java Message Service API)。
  6)spring-boot-starter-batch         支持Spring Batch,包括HSQLDB数据库。
  7)spring-boot-starter-cache      支持Spring的Cache抽象。
  8)spring-boot-starter-cloud-connectors     支持Spring Cloud Connectors,简化了在像Cloud Foundry或Heroku这样的云平台上连接服务。
  9)spring-boot-starter-data-elasticsearch   支持ElasticSearch搜索和分析引擎,包括spring-data-elasticsearch。
  10)spring-boot-starter-data-gemfire   支持GemFire分布式数据存储,包括spring-data-gemfire。
   11)spring-boot-starter-data-jpa     支持JPA(java Persistence API),包括spring-data-jpa、spring-orm、hibernate。
  12)spring-boot-starter-data-MongoDB  支持mongodb数据,包括spring-data-mongodb。
  13)spring-boot-starter-data-rest       通过spring-data-rest-webmvc,支持通过REST暴露Spring Data数据仓库。
  14)spring-boot-starter-data-solr       支持Apache Solr搜索平台,包括spring-data-solr。
  15)spring-boot-starter-freemarker      支持FreeMarker模板引擎。
  16)spring-boot-starter-groovy-templates 支持Groovy模板引擎。
  17)spring-boot-starter-hateoas      通过spring-hateoas支持基于HATEOAS的RESTful Web服务。
  18)spring-boot-starter-hornetq       通过HornetQ支持JMS。
  19)spring-boot-starter-integration       支持通用的spring-integration模块。
  20)spring-boot-starter-jdbc          支持JDBC数据库。
  21)spring-boot-starter-jersey       支持Jersey RESTful Web服务框架。
  22)spring-boot-starter-jta-atomikos    通过Atomikos支持JTA分布式事务处理。
  23)spring-boot-starter-jta-bitronix       通过Bitronix支持JTA分布式事务处理。
  24)spring-boot-starter-mail            支持javax.mail模块。
  25)spring-boot-starter-mobile        支持spring-mobile。
  26)spring-boot-starter-mustache      支持Mustache模板引擎。
  27)spring-boot-starter-Redis          支持redis键值存储数据库,包括spring-redis。
  28)spring-boot-starter-security       支持spring-security。
  29)spring-boot-starter-social-facebook  支持spring-social-facebook
  30)spring-boot-starter-social-linkedin    支持pring-social-linkedin
  31)spring-boot-starter-social-twitter    支持pring-social-twitter
  32)spring-boot-starter-test        支持常规的测试依赖,包括JUnit、Hamcrest、Mockito以及spring-test模块。
  33)spring-boot-starter-thymeleaf        支持Thymeleaf模板引擎,包括与Spring的集成。
  34)spring-boot-starter-velocity       支持Velocity模板引擎。
  35)spring-boot-starter-web       支持全栈式Web开发,包括Tomcat和spring-webmvc。
  36)spring-boot-starter-websocket       支持WebSocket开发。
  37)spring-boot-starter-ws         支持Spring Web Services。

Springboot注解

       @SpringBootApplication:包含了@ComponentScan、@Configuration和@EnableAutoConfiguration注解。其中@ComponentScan让spring Boot扫描到Configuration类并把它加入到程序上下文。
  @Configuration:等同于spring的XML配置文件;使用Java代码可以检查类型安全。
  @EnableAutoConfiguration:自动配置。
  @ComponentScan:组件扫描,可自动发现和装配一些Bean。
  @Component:可配合CommandLineRunner使用,在程序启动后执行一些基础任务。
  @RestController:注解是@Controller和@ResponseBody的合集,表示这是个控制器bean,并且是将函数的返回值直 接填入HTTP响应体中,是REST风格的控制器。
  @Autowired:自动导入。
  @PathVariable:获取参数。
  @JsonBackReference:解决嵌套外链问题。
  @RepositoryRestResourcepublic:配合spring-boot-starter-data-rest使用。
  @EnableAutoConfiguration:Spring Boot自动配置(auto-configuration):尝试根据你添加的jar依赖自动配置你的Spring应用。例如,如果你的classpath下存在HSQLDB,并且你没有手动配置任何数据库连接beans,那么我们将自动配置一个内存型(in-memory)数据库”。你可以将@EnableAutoConfiguration或者@SpringBootApplication注解添加到一个@Configuration类上。这个注释告诉SpringBoot“猜”你将如何想配置Spring,基于你已经添加jar依赖项。如果spring-boot-starter-web已经添加Tomcat和Spring MVC,这个注释自动将假设您正在开发一个web应用程序并添加相应的spring设置。动配置被设计用来和“Starters”一起更好的工作,但这两个概念并不直接相关。您可以自由挑选starter依赖项以外的jar包,springboot仍将尽力自动配置您的应用程序。

       @Bean:相当于XML中的bean,放在方法的上面,而不是类,意思是产生一个bean,并交给spring管理。

猜你喜欢

转载自blog.csdn.net/Soinice/article/details/82387775