随笔分类 -  Spring

摘要:知识点 Spring提供了@Value注解,可用于将配置文件或注册中心的属性值动态注入到Bean中。 注:@Value注解在spring-beans包里。 @Value("${...}"):注入获取对应属性文件中定义的属性值; @Value("#{...}"):表示SpEl表达式通常用来获取Bean 阅读全文
posted @ 2024-07-06 21:56 cdfive 阅读(1010) 评论(0) 推荐(0) 编辑
摘要:## 背景 项目中某配置类`XxxConfig`定义了很多配置参数,通过Spring的`@Value`注解与配置中心的项目yml里的配置项关联。 ``` @Slf4j @Getter @Setter @RefreshScope @Configuration public class XxxConfi 阅读全文
posted @ 2023-03-20 19:29 cdfive 阅读(429) 评论(2) 推荐(0) 编辑
摘要:@RequestMapping("/test/save") public Result save(Integer threadNum, Integer pageIndex, Integer pageSize, Integer totalPage, List<String> productCodes) 阅读全文
posted @ 2021-02-28 10:41 cdfive 阅读(1021) 评论(0) 推荐(0) 编辑
摘要:控制器(Controller) "/":拦截后端接口请求,即通过 、`@RestController @RequestMapping`标记的类,用于后端接口。 "/ ":拦截所有请求,除了后端接口包括,资源文件、JSP页面等。 用web.xml配置,一般配置为"/"。 如果是使用SpringBoot 阅读全文
posted @ 2020-03-28 11:53 cdfive 阅读(760) 评论(0) 推荐(0) 编辑
摘要:Spring生态目前发展很快,Spring、Spring Boot、Spring Cloud、Spring Data等等越来越丰富,并且迭代也很快。 最近在找工作,面试过程中经常有问到Spring的基础知识,其中一个知识点就是Spring中Bean的生命周期。 如果没有准备,突然问这道题有点答不上来 阅读全文
posted @ 2019-04-10 16:29 cdfive 阅读(162) 评论(0) 推荐(0) 编辑
摘要:事务的传播属性 PROPAGATION_REQUIRED 如果当前没有事务,就新建一个事务,如果已经存在一个事务中,加入到这个事务中。// 最常用,@Transactional注解默认 PROPAGATION_REQUIRES_NEW 新建事务,如果当前存在事务,把当前事务挂起。 PROPAGATI 阅读全文
posted @ 2019-02-17 11:34 cdfive 阅读(169) 评论(0) 推荐(0) 编辑

点击右上角即可分享
微信分享提示