![](https://img-blog.csdnimg.cn/20201014180756923.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
springboot
文章平均质量分 82
mytt_10566
这个作者很懒,什么都没留下…
展开
-
SpringBoot(4) - SpringApplication(4) - 自定义Environment或ApplicationContext
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#howto-customize-the-environment-or-application-context 官方文档:SpringApplication的ApplicationListeners和ApplicationCont...翻译 2018-11-12 14:07:11 · 1865 阅读 · 0 评论 -
SpringBoot(3) - SpringApplication(3) - 自定义FailureAnalyzer
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#howto-failure-analyzer FailureAnalyzer是一种很好的方式在启动时拦截异常并将其转换为易读的消息,并将其包含在FailureAnalysis中。 Spring Boot为应用程序上下文相关异常、JS...原创 2018-11-11 23:10:24 · 1935 阅读 · 0 评论 -
SpringBoot(23) - 创建自定义stater(1)
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-developing-auto-configuration 如果公司是开发共享库的,或者在开源社区或商业库中工作,则可能需要开发自己的自动配置。自动配置类可以捆绑在外部jar中,仍然可以通过Spring ...翻译 2018-11-08 18:02:37 · 438 阅读 · 0 评论 -
SpringBoot(27) - SpringBoot Maven插件(1) - 插件简介及打包
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#build-tool-plugins-maven-pluginSpringBoot Maven插件:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/maven-plugin/...翻译 2018-11-11 21:18:46 · 1123 阅读 · 0 评论 -
SpringBoot(26) - WebSocket(2) - stomp协议
示例:(基于stomp协议)用的<<深入浅出SpringBoot 2.x>>书中的例子:不是所有浏览器都支持WebSocket协议,为了兼容不支持的浏览器,可以使用STOMP(Simple or Streaming Text Orientated Messaging Protocol)协议进行处理。1. 添加依赖<dependency> ...原创 2018-11-11 14:45:16 · 536 阅读 · 0 评论 -
SpringBoot(14) - 消息(2) - JMS(2)发送Queue和Topic
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-using-jms-receivingorg.springframework.jms.annotation.EnableJmshttps://blog.csdn.net/liuchuanhong1/art...原创 2018-11-05 18:06:10 · 817 阅读 · 0 评论 -
SpringBoot(13) - 消息(1) - JMS(1)ActiveMQ
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-messaging Spring Framework为与消息传递系统的集成提供了广泛的支持:从使用JmsTemplate简化JMS API的使用到异步接收消息的完整基础结构。Spring AMQP为“高级...翻译 2018-11-05 17:47:14 · 346 阅读 · 0 评论 -
SpringBoot(24) - 创建自定义stater(2) - demo
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-developing-auto-configurationhttps://www.cnblogs.com/cz-xjw/p/6632402.html 计划实现这样一个需求,只有明确说明不自动配置时,则...原创 2018-11-08 22:30:17 · 164 阅读 · 1 评论 -
SpringBoot(25) - WebSocket(1) - websocket协议
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-websockets Spring Boot为嵌入式Tomcat(8和7),Jetty 9和Undertow提供WebSockets自动配置。如果要将war文件部署到独立容器,Spring Boot会...原创 2018-11-11 13:42:23 · 246 阅读 · 0 评论 -
SpringBoot(32) - Properties(4) - 使用Maven自动扩展属性
参考文档:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#howto-automatic-expansion 使用Maven自动扩展属性:可以使用资源过滤从Maven项目自动扩展属性。 如果使用spring-boot-starter-parent,那么可以通过@ .. @占位符引用...翻译 2018-11-12 23:19:43 · 237 阅读 · 0 评论 -
SpringBoot(37) - Actuator(5) - Metrics
参考:https://docs.spring.io/spring-boot/docs/1.5.18.RELEASE/reference/htmlsingle/#production-ready-metrics Spring Boot Actuator包含一个带有“gauge”和“counter”支持的指标服务。 'gauge'记录单个值; 并且'counter'记录增量(增加或减少)。 S...翻译 2019-01-05 23:43:33 · 1855 阅读 · 0 评论 -
SpringBoot(36) - Actuator(4) - Loggers
参考:https://docs.spring.io/spring-boot/docs/1.5.18.RELEASE/reference/htmlsingle/#production-ready-loggers Spring Boot Actuator包括在运行时查看和配置应用程序日志级别的功能。 可以查看整个列表或单个记录器的配置,该配置由显式配置的日志记录级别以及日志记录框架为其提供的有...翻译 2019-01-05 23:43:12 · 373 阅读 · 0 评论 -
SpringBoot(35) - Actuator(3) - 通过JMX监控和管理
参考:https://docs.spring.io/spring-boot/docs/1.5.18.RELEASE/reference/htmlsingle/#production-ready-jmx Java Management Extensions(JMX)提供了一种监视和管理应用程序的标准机制。 默认情况下,Spring Boot会将管理端点暴露为org.springframewo...翻译 2019-01-05 23:43:02 · 2898 阅读 · 0 评论 -
SpringBoot(34) - Actuator(2) - 通过HTTP监控和管理
参考:https://docs.spring.io/spring-boot/docs/1.5.18.RELEASE/reference/htmlsingle/#production-ready-monitoring如果正在开发Spring MVC应用程序,Spring Boot Actuator自动配置所有已启用的端点,并且通过HTTP公开。 默认约定是使用端点的id作为URL路径。 例如,...翻译 2019-01-05 23:42:53 · 1104 阅读 · 0 评论 -
SpringBoot(33) - Actuator(1) - 端点
参考:https://docs.spring.io/spring-boot/docs/1.5.18.RELEASE/reference/htmlsingle/#production-ready Spring Boot包含许多其他功能,可帮助在应用程序投入生产时监视和管理它们。 可以选择使用HTTP端点、JMX甚至远程shell(SSH或Telnet)来管理和监视应用程序。 审核,运行状况和...翻译 2019-01-05 23:42:39 · 608 阅读 · 0 评论 -
SpringBoot(31) - Properties(3) - 类型安全的配置属性
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-external-config-typesafe-configuration-properties 使用@Value("$ {property}")注解来注入配置属性有时会很麻烦,特别是如果正在使用多个属...翻译 2018-11-12 23:16:42 · 396 阅读 · 0 评论 -
SpringBoot(30) - Properties(2) - 使用YAML配置
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-external-config-yaml YAML是JSON的超集,因此对于指定分层配置数据来说是一种非常方便的格式。 只要在类路径上有SnakeYAML库,SpringApplication类就会自动支...翻译 2018-11-12 22:10:03 · 430 阅读 · 0 评论 -
SpringBoot(29) - Properties(1) - 外部配置
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-external-config Spring Boot允许外部化配置,以便在不同环境中使用相同的应用程序代码。 可以使用属性文件、YAML文件、环境变量和命令行参数来外部化配置。可以使用@Value注释将...翻译 2018-11-12 22:09:43 · 282 阅读 · 0 评论 -
SpringBoot(12) - NoSQL(3) - mogodb多数据源配置
参考:https://www.cnblogs.com/ityouknow/p/6828919.html 1. 添加mongodb starter<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-...原创 2018-11-05 14:25:35 · 199 阅读 · 0 评论 -
SpringBoot(11) - NoSQL(2) - mogodb
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-mongodb MongoDB是一个开源的NoSQL文档数据库,它使用类似JSON的模式而不是传统的基于表间关系的数据。 Spring Boot为使用MongoDB提供了便利性,包括spring-boot...原创 2018-11-05 14:12:01 · 196 阅读 · 0 评论 -
SpringBoot(1) - SpringApplication(1) - 自定义Banner
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-banner Banner在项目启动时打印,我们可以在classpath下添加banner.txt改变默认的Banner,或者通过banner.location属性指定banner.txt的位置。 假如...原创 2018-11-01 00:11:29 · 499 阅读 · 0 评论 -
SpringBoot(8) - Web(3) - Servlet、Filter、Listener
SpringBoot中注册Servlet、Filter、Listener的方式 以Servlet为例(Filter、Listener类似,可以参考demo代码):一、方式一 @ServletComponentScan参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot...原创 2018-11-04 13:14:34 · 118 阅读 · 0 评论 -
SpringBoot(12) - 数据源(1) - 使用默认数据源
SpringBoot默认支持4种数据源类型,定义在org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration 中,分别是:org.apache.tomcat.jdbc.pool.DataSourcecom.zaxxer.hikari.HikariDataSourceorg.apache.commons.db...原创 2018-07-16 01:01:19 · 4109 阅读 · 0 评论 -
SpringBoot(28) - SpringBoot Maven插件(2) - war包
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#howto-create-a-deployable-war-file 生成可部署war文件的第一步是提供SpringBootServletInitializer子类并覆盖其configure方法。 这充分利用了Spring Fram...翻译 2018-07-19 22:56:01 · 322 阅读 · 0 评论 -
SpringBoot(20) - 校验(1) - 使用Hibernate Validator
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-validation 1. Validation只要实现了JSR-303规范的实例(例如Hibernate validator)在类路径上,Bean Validation 1.1支持的方法验证功能就会...原创 2018-06-28 16:43:50 · 1084 阅读 · 0 评论 -
SpringBoot(13) - 数据源(2) - 使用Druid数据源
参考:https://blog.csdn.net/saytime/article/details/78963121有很多类似的博客,大概过了一遍整合一下,配置基本一样,自己记录一下。 1.pom.xml添加jpa或jdbc依赖,默认引入tomcat-jdbc连接池,这里可以排除该依赖;其余依次添加mysql、druid依赖。<!-- jpa --><!--...原创 2018-11-04 20:14:42 · 146 阅读 · 0 评论 -
SpringBoot(2) - SpringApplication(2) - Application事件与监听器
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-application-events-and-listeners 除了一般的Spring的事件,例如ContextRefreshedEvent,SpringApplication也会一些额外applica...原创 2018-11-01 14:16:50 · 342 阅读 · 0 评论 -
SpringBoot(5) - 日志
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-logging SpringBoot内部使用Commons Logging,但保留底层日志实现。默认给Java Util Loggin、Log4J2和Logback提供了默认配置。在每种情况下,记录器都预...原创 2018-11-01 22:37:09 · 152 阅读 · 0 评论 -
SpringBoot(22) - Email
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-email Spring框架提供了一个使用JavaMailSender接口发送电子邮件的简单抽象,Spring Boot为它提供了自动配置以及starter模块。提示:参考https://docs.s...翻译 2018-11-08 14:42:53 · 780 阅读 · 0 评论 -
SpringBoot(19) - RestTemplate
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-restclient 1. RestTemplate假如需要从应用程序远程调用REST服务,可以使用Spring的RestTemplate类。因为RestTemplate实例在使用之前通常需要自定义,...翻译 2018-11-07 22:59:14 · 378 阅读 · 0 评论 -
SpringBoot(17) - 消息(5) - Apache Kafka(1)
参考https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-kafka Apache Kafka的支持1. 简介spring-kafka项目的自动配置来支持Apache Kafka。Kafka可以通过spring.kafka.*属性配置。例如,可以在ap...翻译 2018-11-07 14:29:50 · 249 阅读 · 1 评论 -
SpringBoot(10) - NoSQL(1) - redis
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-nosql SpringBoot Data提供了其他项目帮助访问各种NoSQL技术,包括MongoDB,Neo4J,Elasticsearch,Solr,Redis,Gemfire,Cassandra,C...原创 2018-11-04 22:48:46 · 141 阅读 · 0 评论 -
SpringBoot(11) - 数据库(1)
参考文档:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-sql翻译的官方文档,个人理解,仅供参考。 Spring框架为使用SQL数据库提供了广泛的支持。从使用JdbcTemplate直接以JDBC方式访问到完全的Hibernate对象关系映射技术访问。...原创 2018-11-04 20:05:26 · 361 阅读 · 0 评论 -
SpringBoot(7) - Web(2) - 内置服务器
参考文档:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-embedded-container翻译的官方文档,个人理解,仅供参考。 SpringBoot包括对内置Tomcat、Jetty和Undertow服务器的支持。大部分开发者只需使用合适的“Star...原创 2018-11-04 15:06:48 · 5963 阅读 · 0 评论 -
SpringBoot(6) - Web(1)
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-developing-web-applications翻译的官方文档,个人理解,仅供参考。 SpringBoot非常适合web应用程序的开发。可以使用Tomcat、Jetty或Undertow创建自包...原创 2018-11-04 15:06:22 · 211 阅读 · 0 评论 -
SpringBoot(15) - 消息(3) - AMQP(1)RabbitMQ
参考:https://docs.spring.io/spring-boot/docs/1.5.17.RELEASE/reference/htmlsingle/#boot-features-amqp 高级消息队列协议(AMQP)是一个平台中立、线级协议的面向消息的中间件。 Spring AMQP项目将核心Spring概念应用于基于AMQP的消息传递解决方案的开发。Spring Boot提供了...翻译 2018-11-06 10:32:49 · 188 阅读 · 0 评论 -
SpringBoot(21) - 校验(2) - Hibernate Validator注解
Bean Validation是一个通过配置注解来验证参数的框架,它包含两部分Bean Validation API和Hibernate Validator。Bean Validation API是Java定义的一个验证参数的规范。 Hibernate Validator是Bean Validation API的一个实现。Hibernate Validator提供了JSR 303规范...原创 2018-07-03 09:43:20 · 517 阅读 · 0 评论