2016-06-14 35 views
0

是否spring-boot-configuration-processor進程註釋bean方法? 因爲在我的情況下,它沒有。Spring引導配置處理器進程註釋bean方法嗎?

這裏是我的代碼:

@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; 
} 

而且某處@配置註解類:

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

在編譯過程中,不會產生元數據。但是,當DatasourceConnectionPoolProperties獲取註釋與@ConfigurationProperties元數據生成。

我在某個地方犯了錯,還是隻是spring-boot-configuration-processor的限制?

+1

你的方法必須是'public' –

回答

3

它確實但註釋處理器只尋找public方法,而你的方法是protected(這對於一個@Bean方法很不尋常)。