简体   繁体   English

spring-boot-configuration-processor是否处理带注释的bean方法?

[英]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.

相关问题 "在 gradle 多项目中使用 kapt 和 spring-boot-configuration-processor" - Use kapt with spring-boot-configuration-processor in a gradle multi project 什么是spring-boot-configuration-processor? 人们为什么要从中排除图书馆? 为什么它在依赖树中不可见? - What is the spring-boot-configuration-processor ? Why do people exclude libraries from it? Why is it invisible in dependency tree? Maven 需要为托管依赖项 spring-boot-configuration-processor 指定插件版本 - Maven requires plugin version to be specified for the managed dependency spring-boot-configuration-processor 什么时候在 Spring Boot 中执行带有 @Bean 注释的方法? - When are methods annotated with @Bean are excuted in Spring Boot? 当我想从 KAPT 更改为 KSP 时,如何配置 spring-boot-configuration-processor? 我每次都会出错 - How can I configuration spring-boot-configuration-processor when I would like to change from KAPT to KSP? I get every time error Spring java配置中调用@Bean注解的方法 - Calling a @Bean annotated method in Spring java configuration Spring Boot错误bean与配置 - Spring boot error bean with the configuration Spring Boot异常处理的特定注释方法 - Spring boot exception handling for specific annotated methods Spring JavaConfig-在@Bean注释的Config方法上禁用自动装配 - Spring JavaConfig - Disabling Autowiring on @Bean Annotated Config Methods 将Spring引导安全性上下文传播到带有@KafkaListener注释的Bean中 - Propagate Spring boot security context into a bean annotated with @KafkaListener
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM