Commit fb4d8938 by YANGYANG

tokenutils类中获取方式修改 改为读取common_utils resources下文件

parent 2eeeeb74
......@@ -16,7 +16,7 @@ public class PropertieUtil {
String value = "";
try {
Properties prop = new Properties();
FileInputStream fileInputStream = new FileInputStream(url);
InputStream fileInputStream = PropertieUtil.class.getResourceAsStream(url);
prop.load(fileInputStream);
value = prop.getProperty(key);
fileInputStream.close();
......
......@@ -33,21 +33,7 @@ import java.util.*;
public class TokenUtils {
private static Log logger = LogFactory.getLog(HttpClient.class);
private static RequestConfig requestConfig = null;
private static String tokenPath="";
private static String yt_tokenUrl="";
/**
* 静态属性注册配置文件中的值
* @param tokenPath
*/
@Value("${tokenPath}")
void setTokenPath(String tokenPath){
this.tokenPath=tokenPath;
}
@Value("${token_url}")
void setYtgs_tokenUrl(String yt_tokenUrl) {
this.yt_tokenUrl = yt_tokenUrl;
}
private static String tokenPath="/token.properties";
static{
// 设置请求和传输超时时间
......@@ -110,7 +96,7 @@ public class TokenUtils {
object.put("scope", scope);
object.put("client_secret", client_secret);
object.put("client_id", client_id);
String token_url =yt_tokenUrl;
String token_url =PropertieUtil.readTokenValue("token_url",tokenPath);
try {
String resultString = doPostUrlEncodedFormEntity(token_url,headerMap,JSONObject.toJSONString(object));
if (!StringUtils.isEmpty(resultString)) {
......
####################\u4E91\u5929\u839E\u5F0F\u8BF7\u6C42token\u914D\u7F6E\u53C2\u6570##\u5F00\u59CB#################
####################云天请求token配置参数##开始#################
token_url=http://26.3.12.56:8083/api/oauth/token
#header
Authorization=Basic Y2xpZW50YXBwOjEyMzQ1Ng==
Content-Type=application/x-www-form-urlencoded
......@@ -13,4 +14,6 @@ client_id=clientapp
token=
#\u8FC7\u671F\u65F6\u95F4
expiration=
####################云天请求token配置参数##结束#################
......@@ -3,8 +3,3 @@ spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@47.92.129.99:1600:orcl
spring.datasource.username=XZXT
spring.datasource.password=XZXT
####################云天请求token配置参数##开始#################
token_url=http://26.3.12.56:8083/api/oauth/token
tokenPath=G:\\token\\token.properties
####################云天请求token配置参数##结束#################
\ No newline at end of file
......@@ -3,8 +3,3 @@ spring.datasource.driver-class-name=oracle.jdbc.driver.OracleDriver
spring.datasource.url=jdbc:oracle:thin:@10.100.17.120:1521:XZXT
spring.datasource.username=XZXT
spring.datasource.password=XzxtPwd#15
####################云天请求token配置参数##开始#################
token_url=http://26.3.12.56:8083/api/oauth/token
tokenPath=/data/software/token/token.properties
####################云天请求token配置参数##结束#################
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment