
SpringBoot
文章平均质量分 77
跟心爱的人浪迹天涯
Java小学生
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
Windows下使用Grafana和Prometheus实现对SpringBoot项目的JVM实时检测
添加Prometheus支持pom.xml<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId></dependency><dependency> <groupId>io.micrometer</groupId原创 2021-07-15 11:33:29 · 493 阅读 · 0 评论 -
SpringBoot 自动配置启动流程 为什么没有执行selectImports方法
SpringBoot main方法所在类添加了注解@SpringBootApplication, 在此注解中添加了注解@EnableAutoConfiguration, 默认开启了自动配置@Import(AutoConfigurationImportSelector.class)public @interface EnableAutoConfiguration { ...}AutoConfigurationImportSelector实现了DeferredImportSelector接口,原创 2021-02-03 19:32:27 · 2720 阅读 · 4 评论 -
Spring和JDK中观察者设计模式 Event事件监听
观察者设计模式特性被观察者有观察者的引用观察者不能主动发起操作, 需要等被观察者通知在JDK中通过继承Observable类作为一个被观察者, 实现Observer接口作为一个观察者模拟场景 天气变化, 任何狗做出不同反应public class WeatherObservable extends Observable { private int temperature; public int getTemperature() { return temperat原创 2021-01-27 10:48:03 · 318 阅读 · 0 评论 -
SpringBoot通过websocket实现web即时聊天
websocket通常用于即时通讯场景中, 在SpringBoot下也提供了jar支持spring-boot-starter-websocketpom.xml<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:原创 2021-01-24 00:10:11 · 582 阅读 · 0 评论 -
SpringBoot 自动配置启动 tomcat
SpringBoot之所以能有使用java -jar命令启动, 是因为内部嵌入了web容器jar包, 如tomcat, jetty… 分析下SpringBoot中tomcat加载流程.SpringBoot自动依赖spring-boot-autoconfigure-2.1.2.RELEASE.jar(参考版本), 在META-INF文件夹spring.factories文件, 开启了自动装配类ServletWebServerFactoryAutoConfigurationorg.springframewo原创 2021-01-22 18:00:39 · 2020 阅读 · 0 评论 -
SpringBoot添加Swagger2支持 可直接供前端及测试使用 生产环境禁用
pom.xml<dependency> <groupId>io.springfox</groupId> <artifactId>springfox-swagger2</artifactId> <version>2.7.0</version></dependency><dependency> <groupId>io.springfox</grou原创 2020-12-02 16:49:49 · 441 阅读 · 0 评论 -
Guns管理系统使用Redis分布式存储Session
Guns默认使用ConcurrentHashMap作为Session持久化机制,本地session在分布式或者服务重启都存在问题,但本地测试可以使用,生产上一定要用Redis持久化。所以需要动态调整Session持久化机制,ConditionalOnProperty可根据yml或者配置中心参数来指定加载的bean,从而调整持久化机制guns-sys pom.xml<dependency> <groupId>org.springframework.boot</grou原创 2020-11-04 18:39:46 · 871 阅读 · 3 评论 -
SpringBoot静态资源请求失败,添加拦截器,指定后缀 解决方法
SpringBoot静态资源请求失败静态资源存放位置为: /resources/static/**方法一:1.在pom中添加jar包<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf&...原创 2019-02-22 17:49:33 · 3978 阅读 · 0 评论 -
SpringBoot Dubbo整合
1. 项目整体分3个module, 主项目pom.xml如下<?xml version="1.0" encoding="UTF-8"?><project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" ...原创 2019-08-15 14:20:42 · 118 阅读 · 0 评论