package com.xxx.mid.common;
import javax.annotation.PostConstruct;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.PropertySource;
import org.springframework.core.env.Environment;
import org.springframework.stereotype.Component;
//是以classes目录为基础路径
@PropertySource(value = { "classpath:upLocationMarker.properties", "classpath:config.properties" }, encoding = "utf-8")
@Component
public class Properties {
@Autowired
private Environment environment;
private static Environment ent;
@PostConstruct
public void init() {
Properties.ent = environment;
}
public static Environment getEnt() {
return ent;
}
}
读取配置spring注解
最新推荐文章于 2022-11-09 19:56:51 发布