config.peoperties位于src/main/resource目录下
#oss信息
oss.endpoint=xxx
oss.accesskey_id=xxx
oss.accesskey_secret=xxx
import java.util.Properties;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.support.PropertiesLoaderUtils;
public class OssUtil {
public static void main(String[] args) {
Properties prop = PropertiesLoaderUtils.loadProperties(new ClassPathResource("/config.properties"));
String value = prop.getProperty("oss.endpoint");
}
}