Spring
为什么坚持?
人的痛苦源于对自己无能的愤怒!!!
Don't forget, a person's greatest emotional need is to feel appreciated.
莫忘记,人类情感上最大的需要是感恩。
展开
-
自定义注解&& 登录校验&& 打印日志
@documented //作用域@Inherited //是否可被子类继承@Target({ElementType.ANNOTATION_TYPE,ElementType.METHOD,ElementType.FIELD}) //适用范围@Retention(RetentionPolicy.RUNTIME) //是否在运行时被VM保留适用案例: 登录校验定义一个注解@Documented@Retention(RetentionPolicy.RUNTIME)@Target({Elem.原创 2021-06-27 16:47:46 · 125 阅读 · 0 评论 -
@ConfigurationProperties 和 @value 的区别
先模拟一个对象 @Data @Service @ConfigurationProperties(value = "person") public class Person { private String name; private Integer age; private String sex; private List<String> likes; }写配置文件我写的是application.yaml文件..原创 2021-06-27 16:31:59 · 90 阅读 · 0 评论 -
Spring 项目启动时,打印每个bean加载时间
用于解决项目启动慢的问题定位项目启动加载哪些Bean慢的原因@Componentpublic class LoggerBeanLoadCostPostProcessor implements BeanPostProcessor{ private static Logger logger = LoggerFactory.getLogger(LoggerBeanLoadCostPostProcessor.class); private static Map<String, L原创 2020-06-02 09:48:05 · 3026 阅读 · 1 评论 -
Spring 事件监听 继承 ApplicationContextEvent SmartApplicationListener
引子:每次Spring项目启动时,都会加载一些Bean对象,也可以启动一些自定义的类,例如:@Componentpublic class LoadProductType implements ApplicationListener<ContextRefreshedEvent> { @Override public void onApplicationEvent(C...原创 2019-10-10 16:44:24 · 889 阅读 · 0 评论