@PropertySource和@Autowired环境 - null

时间:2017-04-26 13:36:22

标签: properties

环境变量' env'一片空白。为什么呢?

import org.springframework.core.env.Environment;

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

@Autowired
private static Environment env;

1 个答案:

答案 0 :(得分:0)