- 博客(29)
- 资源 (1)
- 收藏
- 关注
原创 springboot整合quartz,生成的job由spring管理可直接注入
pom.xml <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>1.5.14.RELEASE</version> &
2018-09-19 14:20:07
2257
翻译 Minio中桶规则
https://docs.aws.amazon.com/AmazonS3/latest/dev/BucketRestrictions.html A bucket is owned by the AWS account that created it. Bucket ownership is not transferable. When you create a bucket, you cho...
2020-03-20 11:27:45
12846
原创 笔记-使用LCN分布式事物demo
注意事项: 1.tx-lcn版本5.0.2.RELEASE,对应springboot版本:2.1.2.RELEASE 2.先启动LCN事务协调器,具体见:【配置LCN事物协调器】 3.客户端添加依赖: <dependency> <groupId>com.codingapi.txlcn</groupId> <artifactId>txlc...
2019-02-28 17:03:07
1720
1
原创 笔记-配置LCN事务协调器
1.下载源码:https://github.com/codingapi/tx-lcn 选择分支 2.执行tx-manager.sql的sql,创建tx-manager库及t_tx_exception表 3.修改pom文件增加springboot maven插件 <plugins> <plugin> <groupId>org.spr...
2019-02-27 16:58:22
1733
转载 springboot2.0集成百度uidgenerator【笔记】
一句该文章做的笔记:https://blog.youkuaiyun.com/a13794479495/article/details/83541569 1.下载源码https://github.com/baidu/uid-generator,并依据官网创建好表 修改数据库连接池 <!--<dependency> <groupId>com.alibaba</...
2019-02-15 09:45:14
6412
4
转载 项目中常用的19条MySQL优化
做个笔记,来源于https://zhuanlan.zhihu.com/p/49888088 1、EXPLAIN 做MySQL优化,我们要善用EXPLAIN查看SQL执行计划。 下面来个简单的示例,标注(1、2、3、4、5)我们要重点关注的数据: type列,连接类型。一个好的SQL语句至少要达到range级别。杜绝出现all级别。 key列,使用到的索引名。如果没有选择索引,值...
2019-01-24 11:38:02
229
转载 Spring Cloud Eureka 常用配置及说明
转自:https://www.cnblogs.com/li3807/p/7282492.html 配置参数 默认值 说明 服务注册中心配置 Bean类:org.springframework.cloud.netflix.eureka.server.EurekaServerCo...
2019-01-04 17:12:15
652
原创 springboot全局处理异常
1.先决条件: springboot默认异常路径/error 2.访问http://localhost/user/get/-1 3.出错后,/error请求会映射到该controller 4.配置error页面,404,500及其它error页面 5.配置其它青口请求过来的,如app段,处理异常返回 ...
2019-01-02 14:47:41
203
原创 kryo实现序列化至硬盘与从硬盘反序列
1.依赖 <!--序列化工具包--> <dependency> <groupId>com.esotericsoftware</groupId> <artifactId>kryo</artifactId> <version>4.0.2</version&a
2018-12-14 14:22:19
425
原创 springboot2.x adminUI监控
1.server端 pom.xml <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.1.1.RELEASE<...
2018-12-06 14:28:48
3227
原创 spring发送邮件附件显示名中文乱码的解决
原效果: 处理代码 在程序启动时设置: public static void main(String[] args) { //java mail发邮件是附件名过长默认会被截断,附件名显示【tcmime.29121.29517.50430.bin】,主动设为false可正常显示附件名 System.setProperty("mail.mime.splitlongparameters"...
2018-11-28 16:14:37
4447
1
原创 基于redis分布式锁实现quartz调度集群
要求:不使用quartz创建表。 1.springboot工程,quartz创建job由spring管理,具体方式详见:quartz创建job由spring管理 2.配置redis分布式锁,具体方式详见:配置redis分布式锁 3.采用triggerListener来实现 import org.quartz.JobExecutionContext; import org.quartz....
2018-11-22 19:48:21
3195
原创 实现redis分布式锁
springboot工程。redis哨兵 1.配置redis模板 import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.data.redis.connection.je...
2018-11-22 19:38:07
832
1
转载 SpringBoot监听Redis的Key过期事件
原文链接:https://javaweb.io/post/198 Redis的配置 修改conf文件 notify-keyspace-events "Ex" 该配置表示监听key的过期事件,默认未开启 该配置的其他信息(可以监听N多事件),可以参阅配置文件的注释,非常详细 自定义监听器 该监听器会在key过期时候触发 import java.nio.charset.Sta...
2018-11-21 14:41:30
9361
3
原创 springboot整合使用Apollo配置中心
1.创建C:\opt\settings\server.properties目录,并填写内容【env=DEV】 2.创建springboot 项目 版本1.5.17.RELEASE 3.添加Apollo依赖 <!--apollo相关jar包--> <dependency> <groupId>com.ctrip.framework.apollo</g...
2018-11-15 21:47:41
16720
9
原创 update 结果集的优化
表记录条数: SELECT count(1) from db.table1 原sql: UPDATE db.table SET attr1 =1 WHERE attr2 IN ( SELECT A.attr2 FROM ( SELECT attr2 FROM db.table WHERE attr3=3...
2018-11-15 15:50:41
521
原创 Apollo配置中心的安装
参考官方:https://github.com/ctripcorp/apollo/wiki/Quick-Start 1.必要准备 1.jdk版本1.8以上 2.mysql 5.65+以上 Apollo的表结构对timestamp使用了多个default声明,所以需要5.6.5以上版本 https://dev.mysql.com/downloads/file/?id=481117下载5....
2018-11-12 23:23:57
1701
原创 rabbitMQ学习之第一步hello world
安装启动rabbitMQ后,创建用户admin/123456 并给与administrator权限,virtual hosts设置为1 <dependency> <groupId>com.rabbitmq</groupId> <artifactId>amqp-client</artifactId> <version>...
2018-11-08 22:39:42
254
原创 springboot整合thymeleaf学习
idea引导创建springboot项目,勾选依赖 <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-thymeleaf</artifactId> </dependency> <depe...
2018-11-06 21:37:54
225
原创 记一次JDBC Connection [com.alibaba.druid.proxy.jdbc.ConnectionProxyImpl@274fdea6] will not be managed b
在springboot工程中:开启事物管理后执行发现 Creating a new SqlSession SqlSession [org.apache.ibatis.session.defaults.DefaultSqlSession@47e872bf] was not registered for synchronization because synchronization is not ...
2018-09-07 16:49:00
38032
10
原创 springboot 邮件发送
1.引入依赖 <!--邮件发送--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-mail</artifactId> </dependency> 2.填写配置
2018-08-24 15:14:27
421
原创 springboot整合redis哨兵方式配置
1.springboot工程引入redis <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency> 2.applicat...
2018-08-24 14:53:53
21846
3
原创 记一次Optional导致的 java.util.NoSuchElementException: No value present
在跑任务的时候,代码 Optional<CompanyComSizeBean> comSizeMaxCompanyComSizeBean = entrySet.getValue().stream() .filter(bean -> bean.getComSizeMax() >= finalComSizeMin) ...
2018-08-10 16:44:46
24201
4
原创 springboot config配置Scheduling
@EnableScheduling开启注解 @Schedules(value = { @Scheduled(cron = "0 15 0 1 * ?"), @Scheduled(cron = "0 15 0 15 * ?") }) @Scheduled(cron = "0 40 15 * * ?") 在方法上配置执行表达式...
2018-08-10 15:41:04
779
原创 spring注解配置ehcache
spring采用注解方式配置ehcache2.x版本 导入jar包: <dependency> <groupId>net.sf.ehcache</groupId> <artifactId>ehcache</artifactId> <version>2.7.2</version&
2018-07-30 15:11:41
790
原创 java config方式配置spring线程池
配置文件:thread.properties//线程池维护线程的最少数量 spring.corePoolSize=5 //允许的空闲时间 spring.keepAliveSeconds=200 //线程池维护线程的最大数量 spring.maxPoolSize=10 //缓存队列 spring.queueCapacity=20代码:import org.springframework.beans....
2018-06-22 15:04:47
2162
2
原创 spring手动回滚事物
方法上加注解@Transactional(rollbackFor = { Exception.class })手动回滚事物try{ xxxMapper.saveXXX(saveXXX); if(true){ throw new Exception("保存xxx失败"); } }catch (Exception e){ //在catch异常中进行手动回滚 TransactionAspe...
2018-06-06 15:34:29
5219
原创 全局处理异常
import com.alibaba.fastjson.JSON; import com.google.common.collect.Maps; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.web.bind.annotation.ControllerAdvice; impor...
2018-06-04 17:49:55
221
原创 spring注解方式配置redis哨兵
配置文件: #redis哨兵配置文件 sentinel.host1=192.168.xx.xx sentinel.host2=192.168.xx.xx sentinel.port1=xxxx sentinel.port2=xxxx redis.password=xxxx redis.database=0 redis.pool.maxTotal=500 #最大能够保持idel状态的对象数...
2018-06-04 17:47:26
975
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅