
spring-boot
文章平均质量分 68
严严严的博客
做一些技术备案,方便学习
展开
-
SpringBoot中ApplicationListener事件监听的6种方式
Event事件:import org.springframework.context.ApplicationEvent;public class TestEvent extends ApplicationEvent { public TestEvent(Object source) { super(source); }}文章目录一、向ApplicationContext中添加监听器二、将监听器作为组件交给spring容器管理三、在application.prop原创 2021-07-05 16:42:55 · 1756 阅读 · 0 评论 -
SpringBoot声明连接多个redis数据源配置模版
在实际开发中,我们可能会用到2个不同的redis数据源;如何连接查询详情:文章目录一、依赖二、配置文件三、config类配置四、序列化问题一、依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>...原创 2020-03-30 13:44:18 · 10048 阅读 · 2 评论 -
spring boot 特性一:自动配置原理分析
Spring Boot中引入了自动配置,让开发者利用起来更加的简便、快捷,本篇分析下Spring Boot中的自动配置原理。注解结构:文章目录一、启动类:二、@SpringBootApplication注解三、@EnableAutoConfiguration一、启动类:二、@SpringBootApplication注解进入@SpringBootApplication的注解类,会发现...原创 2020-02-16 17:49:54 · 86275 阅读 · 0 评论 -
SpringBoot + docker 遇到上传文件至服务器指定目录及找不到的问题
问题描述使用springboot实现文件上传,本地测试无问题。将服务部署到docker中之后,再次进行上传测试,程序不报错,但是预期位置没有文件。需求1.我要上传文件到服务器根目录下/opt/nginx/html中,代码中设置为:file.path=/opt/nginx/html启动服务,上传文件,服务未报错,但是未在/opt/nginx/html中找到我要上传的文件查找文件,使...原创 2020-01-02 15:49:52 · 5261 阅读 · 0 评论 -
Spring Boot 之SpringApplication准备阶段以及运行阶段
SpringApplication类的直接作用是在main方法中通过自有的run方法启动spring应用一般的,在idea新建spring boot 工程之后会有一个启动类,执行main方法也就启动了spring应用@SpringBootApplicationpublic class HouseWebApplication { public static void main(Str...原创 2019-11-28 16:47:04 · 490 阅读 · 0 评论 -
spring boot 发送邮件
1、jar包引入<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId></dependency>2、配置文件spring.mail.host...原创 2019-11-02 18:11:13 · 416 阅读 · 0 评论 -
Spring Boot 核心三大注解讲解
Spring Boot 最大的特点是无需 XML 配置文件,能自动扫描包路径装载并注入对象,并能做到根据 classpath 下的 jar 包自动配置。所以 Spring Boot 最核心的 3 个注解就是:1、@Configuration详细案例可查看:使用@Configuration注解来代替Spring的bean配置这是 Spring 3.0 添加的一个注解,用来代替 applica...转载 2019-08-29 16:12:12 · 2502 阅读 · 0 评论 -
SpringBoot 开发使用thymeleaf模板开发html页面
最近写一些小功能时,想写些页面验证一下效果,后台用的是SpringBoot,当时想用jsp写页面来着,但是springboot不推荐使用jsp,因为jsp在springboot中有诸多限制。springboot中推荐使用thymeleaf模板,使用html作为页面展示,所以这篇博客记录一下如何初步使用thymeleaf开发html。1、在pom.xml文件中添加thymeleaf依赖&amp;amp;lt;...原创 2019-03-15 12:12:51 · 2722 阅读 · 0 评论 -
springboot之使用redistemplate操作redis,自定义JedisPoolConfig连接池
pom文件: <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> <ex...原创 2019-01-15 13:47:53 · 13420 阅读 · 1 评论 -
springboot之使用redistemplate操作redis
本文只记录相关code概念内容参考:https://blog.youkuaiyun.com/ruby_one/article/details/79141940springboot 与redis的整合:pom文件: &amp;lt;dependency&amp;gt; &amp;lt;groupId&amp;gt;org.springframework.boot&amp;lt;/grou原创 2019-01-07 16:00:48 · 3693 阅读 · 2 评论 -
spring boot 2.0.3使用Lettuce Redis并配置 pool
依赖的jar包: &amp;amp;lt;dependency&amp;amp;gt; &amp;amp;lt;groupId&amp;amp;gt;org.springframework.boot&amp;amp;lt;/groupId&amp;amp;gt; &amp;amp;lt;artifactId&am原创 2019-01-07 14:30:38 · 12009 阅读 · 3 评论 -
springboot使用RestTemplate+httpclient连接池发送http消息
简介1、RestTemplate是spring支持的一个请求http rest服务的模板对象,性质上有点像jdbcTemplate。2、RestTemplate底层还是使用的httpclient(org.apache.http.client.HttpClient)发送请求的。3、HttpClient可以做连接池,而发送消息的工具类可以使用RestTemplate,所以如果你的项目需求ht...原创 2018-12-26 16:45:54 · 10486 阅读 · 2 评论