spring
大橙子C
这个作者很懒,什么都没留下…
展开
-
Spring 注解读取配置文件
直接上代码 package com.zbmes.common; import org.springframework.beans.factory.annotation.Value; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.PropertySource; /** * 系统配置类 */ @Configuration @Property原创 2020-08-26 09:50:44 · 1049 阅读 · 0 评论 -
启动服务器时将配置参数从数据库中加载到缓存
最近做项目,碰到这样的需求:在服务器启动的时候从数据库读取参数,将参数保存到内存缓存中 由于使用的是spring的自动注入方式,一开始用@component注解在启动的时候加载查询配置参数的bean,由于bean中要用到其他bean来查询,但此时都为null 查询相关资料,发现@PostConstruct可以解决 /** * 参数配置相关服务类 * @author Dell * */ @S...原创 2018-10-07 16:22:50 · 1854 阅读 · 0 评论 -
属性拷贝报错
日期类型的注册器ConvertUtils.register(new DateConverter(null), java.util.Date.class); ConvertUtils.register(new BigDecimalConverter(null), java.math.BigDecimal.class);原创 2018-11-01 15:43:31 · 160 阅读 · 0 评论 -
问题解决 利用切面 通过自定义注解 实现日至记录功能
背景: 打算利用切面 通过自定义注解 在项目中实现日至记录功能。 项目技术: 项目中使用了springmvc,shiro等 代码: 1.注解类 /** * 自定义操作日志记录注解 */ @Target({ ElementType.PARAMETER, ElementType.METHOD }) @Retention(RetentionPolicy.RUNTIME) @Documented p...原创 2019-08-10 09:40:42 · 241 阅读 · 0 评论