Java

Glide 4.x找不到AppGlideModule

Glide 4.x找不到AppGlideModule

翻阅Release日志:https://github.com/bumptech/glide/releases 查看Glide 4.5.0 Release更新日志:Glide must be compiled against API 27 也就是说:Glide 4.5.0及以上版本不能使用API 27

Joe.Ye Joe.Ye 2023-03-11
0 0 0
MyBatis mybatis-generator自定义plugin

MyBatis mybatis-generator自定义plugin

字段添加注释 generatorConfig.xml添加自定义plugin示例 <!-- 生成的代码去掉注释 --> <commentGenerator type="com.lianpay.globalpay.remit.common.plugin.CommentGen

Joe.Ye Joe.Ye 2023-03-11
0 0 0
MyBatis根据List批量更新及删除记录

MyBatis根据List批量更新及删除记录

查询 //根据多个设备id获取设备信息 public List<Devices> getDevicesList(@Param("devicesIds") String[] devicesIds); <select id="getDevicesList

Joe.Ye Joe.Ye 2023-03-11
0 0 0
MyBatis中插入记录后获取该条记录ID

MyBatis中插入记录后获取该条记录ID

主键生成有两种方式: 主键自增长,需要得到插入成功后数据库生成的id 自定义主键,主要用于分布式开发,一般是现在java代码中生成id,然后存入数据库 MyBatis中主键回填的两种实现方式: (1)推荐方式 <insert id="insert" useGenera

Joe.Ye Joe.Ye 2023-03-11
0 0 0
Spring Boot中MyBatis打印sql

Spring Boot中MyBatis打印sql

如果使用的是application.properties文件,加入如下配置: logging.level.cn.appblog.demo=debug logging.level.*后面的路径指的是Mybatis对应的方法接口所在的包,并不是mapper.xml所在的包。 如果使用的是applica

Joe.Ye Joe.Ye 2023-03-11
0 0 0
MyBatis之java.lang.UnsupportedOperationException异常解决方案

MyBatis之java.lang.UnsupportedOperationException异常解决方案

今天在使用MyBatis执行sql语句时,出现如下异常: 执行的sql语句配置信息如下: <select id="getColumnsByTableName" parameterType="String" resultType="java.ut

Joe.Ye Joe.Ye 2023-03-11
0 0 0
MyBatis根据List批量查询List结果

MyBatis根据List批量查询List结果

基本使用 (1) Mapper接口 /** * 根据用户id list批量查询用户 */ public List<User> selectByIds(@Param("userIds") List<Long> userIds); (2) mapper.

Joe.Ye Joe.Ye 2023-03-11
0 0 0
Spring Boot手动注入Bean

Spring Boot手动注入Bean

应用场景 Spring Boot项目中,我们可能遇到@Autowired注入对象为null的问题,可能的原因包含: (1)当前类的初始化在注入类注入之前 (2)多线程环境,新创建的线程中,是不能自动注入Bean/Service的 此时就需要手动注入Bean 手动获取Bean的工具类 原理,在项目启

Joe.Ye Joe.Ye 2023-03-11
0 0 0
Spring Boot获取profile值

Spring Boot获取profile值

Environment方式 @Autowired Environment environment; String profile = environment.getActiveProfiles()[0];

Joe.Ye Joe.Ye 2023-03-11
0 0 0
Spring Boot弃用Tomcat选择Undertow作为容器

Spring Boot弃用Tomcat选择Undertow作为容器

Undertow 在Spring Boot框架中,我们使用最多的是Tomcat,这是Spring Boot默认的容器技术,而且是内嵌式的Tomcat。同时,SpringBoot也支持Undertow容器,我们可以很方便的用Undertow替换Tomcat,而Undertow的性能和内存使用方面都优于

Joe.Ye Joe.Ye 2023-03-11
0 0 0
Spring Boot 实现ErrorController接口处理404、500等错误页面

Spring Boot 实现ErrorController接口处理404、500等错误页面

在项目中我们遇到404找不到的错误、或者500服务器错误都需要配置相应的页面给用户一个友好的提示,而在Spring Boot中我们需要如何设置。 我们需要实现ErrorController接口,重写handleError方法。 import org.springframework.boot.aut

Joe.Ye Joe.Ye 2023-03-11
0 0 0
Spring Boot 2.0 之优雅停机

Spring Boot 2.0 之优雅停机

Spring Boot“约定大于配置”的特性,体现了优雅流畅的开发过程,其部署启动方式java -jar xxx.jar也很优雅。但是通常使用的停止应用方式是kill -9 进程号,即使写了脚本,还是显得有些粗鲁。这样的应用停止方式,在停止的那一刹那,应用中正在处理的业务逻辑会被中断,导致产生业务异

Joe.Ye Joe.Ye 2023-03-11
0 0 0
Spring Boot优雅停止服务的几种方法

Spring Boot优雅停止服务的几种方法

在使用Spring Boot的时候,都要涉及到服务的停止和启动,当我们停止服务的时候,很多时候大家都是kill -9直接把程序进程杀掉,这样程序不会执行优雅的关闭。而且一些没有执行完的程序就会直接退出。 我们很多时候都需要安全的将服务停止,也就是把没有处理完的工作继续处理完成。比如停止一些依赖的服务

Joe.Ye Joe.Ye 2023-03-11
0 0 0
Spring Boot读取classpath下文件

Spring Boot读取classpath下文件

开发过程中,必不可少的需要读取文件,对于打包方式的不同,还会存在一些坑,比如以jar包方式部署时,文件都存在于jar包中,某些读取方式在开发工程中都可行,但是打包后,由于文件被保存在jar中,会导致读取失败。 这时就需要通过类加载器读取文件,类加载器可以读取jar包中的class类当然也可以读取ja

Joe.Ye Joe.Ye 2023-03-11
0 0 0
Spring Cloud Eureka注册中心服务状态变更

Spring Cloud Eureka注册中心服务状态变更

剔除服务:OUT_OF_SERVICE put请求:http://127.0.0.1:8000/eureka/apps/SERVICE-APPBLOG/192.168.0.1:service-appblog:8080/status?value=OUT_OF_SERVICE 恢复服务:UP put请

Joe.Ye Joe.Ye 2023-03-11
0 0 0
1 17 18 19 20 21 29