以下代码适用于 Spring boot 1.5.3,但在 2.4.4 中失败
@DependsOn({"abcd"})
public PropertyOverrideConfigurer propertyOverrideConfigurer() {
PropertyOverrideConfigurer p = new PropertyOverrideConfigurer();
Properties properties = new Properties();
properties.setProperty("abcd.efgh", "true");
p.setProperties(properties);
return p;
}
@Bean
public Abcd abcd(){
return new Abcd();
}
它失败并出现以下错误
Description:
A component required a bean named 'abcd' that could not be found.
Action:
Consider defining a bean named 'abcd' in your configuration.