在applicationContext.xml文件中要配置bean,读取配置文件
<context:property-placeholder location="classpath*:*.properties" ignore-resource-not-found="true" />
配置文件放在根目录的resource中
注意:在配置文件中“=”左右都不能有空格
ossDomainName=http://oss地址
代码如下
package com.headlinemanage.openlowrie.monitor;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
import java.io.IOException;
import java.util.Properties;
import java.util.Timer;
import java.util.TimerTask;
import org.springframework.beans.factor