![](https://img-blog.csdnimg.cn/20201014180756927.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
spring boot
专注于spring boot知识的讲解
安小然然
这个作者很懒,什么都没留下…
展开
-
spring boot 配置跨域
spring boot 配置跨域原创 2022-04-19 09:32:08 · 1191 阅读 · 0 评论 -
RedisTemplate multiGet
RedisTemplate multiGet原创 2022-04-18 13:33:29 · 3917 阅读 · 0 评论 -
spring boot 集成Kafka配置文件详解
spring: kafka: consumer:2 配置 2.1 group-id group-id: Data 2.1.1 spring boot源码的配置文件是这么说的 Unique string that identifies the consumer group to which this consumer belongs. 2.1.2 Kaf...原创 2021-12-21 14:34:40 · 1755 阅读 · 0 评论 -
spring boot操作redis
spring boot操作redis list数据结构原创 2021-12-09 14:54:00 · 721 阅读 · 0 评论 -
spring boot 定时任务执行完一次下次执行按照指定间隔
1 需求 spring boot 运行定时任务的时候,这次执行完,再按照指定间隔执行下一次,并不是多久指定 一次2 前提条件 使用的是spring boot @Scheduled 注解3 配置@Scheduled(fixedDelay = 1000 * 60 * 60) 1000 是秒...原创 2021-12-07 10:28:30 · 2199 阅读 · 0 评论 -
whose size is larger than the fetch size
1 整体异常描述org.apache.kafka.common.errors.RecordTooLargeException: There are some messages at [Partition=Offset]: {ME1000002013-8=4791187} whose size is larger than the fetch size 1048576 and hence cannot be returned. Please considering upgrading your bro.原创 2021-11-24 11:39:10 · 2010 阅读 · 0 评论 -
spring boot集成Redis
1 背景 使用spring boot 封装的Jedis客户端进行操作Redis操作2 步骤2.1 引入pom 前提条件是已经集成了spring boot 父依赖 <!-- spring boot redis 依赖--> <dependency> <groupId>org.springframework.boot</groupId> ...原创 2021-11-23 10:08:18 · 177 阅读 · 0 评论 -
spring boot集成Kafka以消费者的形式
1 总体说明 分为两种类型的集成 以消费者的形式集成Kafka 以生产者的形式集成Kafka2 以消费者的形式集成Kafka原创 2021-11-17 17:13:18 · 1688 阅读 · 0 评论 -
spring boot 部署启动时指定外部配置文件
需求 spring boot在部署的时候,希望运维人员可以更改配置文件解决方案 外挂配置文件java -jar -Dspring.config.location=配置文件位置 jar包位置原创 2021-11-08 11:52:04 · 469 阅读 · 0 评论 -
spring boot 打包以后读取不到resource下文件
前提条件 前提条件是固定的,就是你把reource下面放了文件,本地开发的时候可以读取到,打包以后读取不到了。 解决方案 我需要读取JSON文件的内容,只是举了个例子,注意直接用reource.getFile也是不行的 ClassPathResource resource = new ClassPathResource("mapping.json"); InputStream inputStream = resource.getInputStr...原创 2021-10-27 10:28:10 · 1095 阅读 · 0 评论 -
spring boot本地开发不连接注册中心
需求 本地开发的时候常常不需要连接注册中心,如何只在本地开发环境关闭呢代码 在开发环境的配置文件中加入如下配置spring: cloud: discovery: enabled: false原创 2021-10-26 16:25:36 · 880 阅读 · 0 评论 -
Caused by: java.lang.NoClassDefFoundError: org/springframework/kafka/listener/ContainerProperties
背景此方案有前提要求,加入不是这个场景则该解决方案不适用 spring boot 版本2.1.3.RELEASE 并且自己引入了如下pom <dependency> <groupId>org.springframework.kafka</groupId> <artifactId>spring-kafka</artifactId> ...原创 2021-08-16 16:19:16 · 1650 阅读 · 0 评论 -
spring boot集成Mybatis
需求 spring boot 体系集成数据持久层框架,技术选型是mybatis 使用注解的方式编写SQL版本 spring boot 2.1.3.RELEASE mybatis-spring-boot-starter 2.0.0spring: datasource: url: jdbc:postgresql://192.168.50.11:54032/postgres driverClassName:...原创 2021-08-16 10:33:06 · 206 阅读 · 0 评论 -
redis.clients.jedis.HostAndPort.getLocalHostQuietly cant resolve localhost address
1 背景 使用spring boot整合redis spring boot版本为2.0.6.RELEASE 服务部署在Linux服务器2 解决方案 登录自己服务部署的Linux服务器 首先查看自己主机名 hostname 输出 查看服务器配置文件 vim /etc/hosts加入如下配置即可...原创 2021-07-26 10:29:16 · 785 阅读 · 0 评论 -
mybatis集成spring boot开启驼峰配置
配置文件格式yml格式mybatis.configuration.map-underscore-to-camel-case : true原创 2020-12-16 20:21:14 · 276 阅读 · 0 评论 -
spring boot集成mybatis mybatis.mapper-locations 属性配置
小插曲---(如果你们公司想使用spring cloud进行微服务改造,本人提供完整的解决方案GITHUB 地址https://github.com/Mranxiaoranran/spring-cloud-sofaQQ 2767855941) 需求分析 1 spring boot 集成 mybaits 2 mybatis使用XML作为数据源接...原创 2018-07-17 11:10:29 · 42008 阅读 · 0 评论 -
Spring boot体系下,两种定时任务实现------面向使用者--持续更新
@Scheduled这个模式就比较简单了,属于spring 框架自身编写的定时任务,具体实现此处不详细说明用法 1 spring boot启动类上增加注解 @EnableScheduling示例 2编写一个类,在类上面增加注解 @Component示例 3 在类中写一个方法,这个方法的内容就会定期执行,执行周期为cron表达式示例 集成Quartz 此处先说明一下范围 1)定时任务不会...原创 2020-09-08 10:24:04 · 221 阅读 · 0 评论 -
Spring boot 集成发送邮件
背景 底层框架为spring boot 版本为 2.1.3.RELEASE 需求就是通过程序给别人发送邮件 你已经开通了一个可以发送邮件的邮箱,不会的话百度一下相关知识技术实现 引入开箱即用的pom <dependency> <groupId>org.springframework.boot</groupId> <artifactId>s...原创 2020-06-02 18:06:33 · 304 阅读 · 0 评论 -
@EnableConfigurationProperties 与@ConfigurationProperties 配合使用
版本说明 功能特性必须基于版本来进行说明,因为版本在更迭中,功能可能就失效了。版本 spring boot 2.1.3.RELEASE@ConfigurationProperties 这个注解直接加在类上面,这个类就可以和spring boot配置文件进行一 一映射。@EnableConfigurationProperties 这个注解的作用是,让@ConfigurationProperties 修饰的类可以加载到spring ioc中...原创 2020-05-25 17:21:49 · 760 阅读 · 0 评论 -
spring boot 打成war
前提条件 1) 工程已经可以成功打成jar,并且运行改造步骤 1) 在pom中增加如下配置<packaging>war</packaging> 2)跟启动类同级增加类 DemoApplication替换成你的启动类import org.springframework.boot.builder.SpringApplicationBuilder;import org.spr...原创 2020-05-14 18:40:26 · 212 阅读 · 0 评论 -
Centos安装consul,使用wget方式
开门见山,文档不足 下载下来的是zip包,不是tar包,未能解决下载wget https://releases.hashicorp.com/consul/1.3.0/consul_1.3.0_linux_amd64.zip安装uzipyum -y install wget解压unzip consul_1.3.0_linux_amd64.zip测试./cons...原创 2020-04-20 12:41:14 · 413 阅读 · 0 评论 -
Caused by: java.lang.ClassNotFoundException: org.springframework.boot.actuate.health.OrderedHealthAg
引入<dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-actuator</artifactId></dependency>原创 2019-11-25 15:30:05 · 3088 阅读 · 0 评论 -
JPA条件查询
1 需求 1 使用JPA进行查询,并且不分页 2 查询条件是 A = 1 并且 B=22 怎么做 1 在接口中新一个方法, findByAAndB(String a ,String b )...原创 2019-11-25 13:48:34 · 3235 阅读 · 0 评论 -
spring boot 相关pom为什么不需要指定版本号
使用spring boot工程 会自动引入 spring-boot-dependencies 这个模块 这个模块里面使用了 dependencyManagement 这个标签 所以 groupId =org.springframework.boot 都不需要写版本号...原创 2019-10-17 14:58:49 · 1638 阅读 · 0 评论