I have an issue with connecting environment to my Spring project.
In this class
@Configuration
@ComponentScan(basePackages = "my.pack.offer.*")
@PropertySource("classpath:OfferService.properties")
public class PropertiesUtil {
@Autowired
private Environment environment;
@Bean
public String load(String propertyName)
{
return environment.getRequiredProperty(propertyName);
}
}
environment always is null.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…