Vsevolod Poletaev
Vsevolod Poletaev

Reputation: 1532

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?

Upvotes: 0

Views: 972

Answers (1)

Stephane Nicoll
Stephane Nicoll

Reputation: 33111

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).

Upvotes: 3

Related Questions