📜  spring 环境空指针异常 - 任何代码示例

📅  最后修改于: 2022-03-11 14:58:25.882000             🧑  作者: Mango

代码示例1
@Configuration
@PropertySource(value = { "classpath:kid-batch.properties" }, ignoreResourceNotFound = false)
public class BatchConfiguration implements EnvironmentAware {

private static Environment env;

public static String getProperty(String key) {
    return env.getProperty(key);
}

@Override
public void setEnvironment(Environment env) {
    BatchConfiguration.env = env;
}