随笔分类 -  Spring Boot

摘要:Spring 事务,当方法内部调用的时候, 事务会失效。 /** * 在事务A方法中,直接调用事务B方法,B方法拥有事务的能力是因为 spring aop 生成了代理对象,但是方法直接调用了this对象的方法,所以B方法不会生成事务。 * 这里的@Transactional 将会失效 */ @Tra 阅读全文
posted @ 2024-12-27 15:59 currentTimeMillis 阅读(478) 评论(0) 推荐(0)
摘要:Spring boot 中有时候需要控制配置类是否生效,使用 @ConditionalOnProperty 注解来控制 @Bean 是否生效。 例: @ConditionalOnProperty(prefix = "config",name = "enable",havingValue = "tru 阅读全文
posted @ 2021-03-16 19:52 currentTimeMillis 阅读(1028) 评论(0) 推荐(0)
摘要:一、最近使用 因为 @SpringBootApplication 已经集成了它,平时就不怎么用。 最近在搭建项目框架, 使用的 maven 子模块 @SpringBootApplication 在boot模块中。 主要业务代码在另外两个子模块中。 项目启动时发现, 只启动了boot模块。两外两个模块 阅读全文
posted @ 2021-03-12 17:22 currentTimeMillis 阅读(105) 评论(0) 推荐(0)