Search code examples
springspring-bootspring-annotations

Does spring-boot-configuration-processor process annotated bean methods?


Does spring-boot-configuration-processor process annotated bean methods? 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:

@Bean
@ConfigurationProperties("persistence.pool")
protected DatasourceConnectionPoolProperties localPoolProperties() {
  return new DatasourceConnectionPoolProperties();
}

During compilation, no metadata generated. But, when DatasourceConnectionPoolProperties gets annotated with @ConfigurationProperties metadata generated.

Did I make mistake somewhere, or it's just spring-boot-configuration-processor limitations?


Solution

  • It does but the annotation processor only looks for public method and yours is protected (which is very unusual for a @Bean method by the way).