“Spring Boot 常见注解”的版本间的差异
跳到导航
跳到搜索
Jihongchang(讨论 | 贡献) |
Jihongchang(讨论 | 贡献) |
||
第1行: | 第1行: | ||
+ | === @Bean === | ||
+ | https://docs.spring.io/spring-javaconfig/docs/1.0.0.M4/reference/html/ch02s02.html | ||
+ | |||
+ | @Bean 是一个方法级注释,是 XML <bean/> 元素的直接模拟。 | ||
+ | |||
+ | |||
=== @ConditionalOnClass === | === @ConditionalOnClass === | ||
https://docs.spring.io/spring-boot/docs/2.0.1.RELEASE/api/index.html?org/springframework/boot/autoconfigure/condition/ConditionalOnClass.html | https://docs.spring.io/spring-boot/docs/2.0.1.RELEASE/api/index.html?org/springframework/boot/autoconfigure/condition/ConditionalOnClass.html |
2023年1月31日 (二) 01:51的版本
@Bean
https://docs.spring.io/spring-javaconfig/docs/1.0.0.M4/reference/html/ch02s02.html
@Bean 是一个方法级注释,是 XML <bean/> 元素的直接模拟。
@ConditionalOnClass
只有当指定的类在类路径上时才匹配。
@ConditionalOnMissingBean
仅当指定的 bean 类和/或名称尚未包含在 BeanFactory 中时才匹配。
@ConditionalOnProperty
条件检查指定的属性是否具有特定值。
默认情况下,属性必须存在于环境中并且不等于 false。
havingValue() 和 matchIfMissing() 属性允许进一步定制。