[英]Does spring-boot-configuration-processor process annotated bean methods?
Does spring-boot-configuration-processor
process annotated bean methods? spring-boot-configuration-processor
处理带注释的bean方法? Because in my case, it doesn't. 因为就我而言,事实并非如此。
Here is my code: 这是我的代码:
@Data
public class DatasourceConnectionPoolProperties {
private Integer initialSize;
private Integer maxIdle;
private Integer minIdle;
private Integer timeBetweenEvictionRunsMillis;
private Integer minEvictableIdleTimeMillis;
private Boolean testOnBorrow;
private String validationQuery;
}
And somewhere in @Configuration-annotated class: 在@Configuration注释的类中的某处:
@Bean
@ConfigurationProperties("persistence.pool")
protected DatasourceConnectionPoolProperties localPoolProperties() {
return new DatasourceConnectionPoolProperties();
}
During compilation, no metadata generated. 编译期间,未生成任何元数据。 But, when
DatasourceConnectionPoolProperties
gets annotated with @ConfigurationProperties
metadata generated. 但是,当
DatasourceConnectionPoolProperties
用生成的@ConfigurationProperties
元数据注释时。
Did I make mistake somewhere, or it's just spring-boot-configuration-processor
limitations? 我是在某个地方犯了错误,还是仅仅是
spring-boot-configuration-processor
限制?
它可以,但是注释处理器仅查找public
方法,而您的则protected
(顺便说一句,对于@Bean
方法,这是非常不寻常的)。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.