2017-04-26 62 views
-1

環境變量'env'爲空。爲什麼?@PropertySource和@Autowired環境 - null

import org.springframework.core.env.Environment; 

@Configuration 
@ComponentScan(basePackages = { "src.main.resources" }) 
@PropertySource("classpath:application.properties") 
public class PropertiesUtil { 

@Autowired 
private static Environment env; 

回答