mirror of
https://gitee.com/dromara/MaxKey.git
synced 2025-12-08 18:08:35 +08:00
jar升级和代码优化
This commit is contained in:
parent
b55261ffe4
commit
4d5b20baa9
@ -27,9 +27,9 @@ jibToAuthPassword =docker registry credential
|
|||||||
|
|
||||||
#maxkey used jars version
|
#maxkey used jars version
|
||||||
#spring
|
#spring
|
||||||
springVersion =6.0.14
|
springVersion =6.0.16
|
||||||
springBootVersion =3.1.6
|
springBootVersion =3.1.8
|
||||||
springSecurityVersion =6.1.5
|
springSecurityVersion =6.1.6
|
||||||
springDataVersion =3.0.3
|
springDataVersion =3.0.3
|
||||||
springkafkaVersion =3.0.13
|
springkafkaVersion =3.0.13
|
||||||
springretryVersion =1.3.3
|
springretryVersion =1.3.3
|
||||||
@ -77,10 +77,10 @@ freemarkerVersion =2.3.32
|
|||||||
xmlbeansVersion =5.0.2
|
xmlbeansVersion =5.0.2
|
||||||
poiVersion =5.2.3
|
poiVersion =5.2.3
|
||||||
#tomcat
|
#tomcat
|
||||||
tomcatVersion =10.1.16
|
tomcatVersion =10.1.18
|
||||||
#logs
|
#logs
|
||||||
log4jVersion =2.21.1
|
log4jVersion =2.22.1
|
||||||
slf4jVersion =2.0.7
|
slf4jVersion =2.0.11
|
||||||
jbossloggingVersion =3.5.0.Final
|
jbossloggingVersion =3.5.0.Final
|
||||||
#Messaging Kafka & RocketMQ
|
#Messaging Kafka & RocketMQ
|
||||||
kafkaclientsVersion =3.4.0
|
kafkaclientsVersion =3.4.0
|
||||||
@ -95,8 +95,8 @@ tinkVersion =1.8.0
|
|||||||
zxingcoreVersion =3.5.1
|
zxingcoreVersion =3.5.1
|
||||||
concurrentlinkedhashmaplruVersion =1.4.2
|
concurrentlinkedhashmaplruVersion =1.4.2
|
||||||
#json
|
#json
|
||||||
gsonVersion =2.9.1
|
gsonVersion =2.10.1
|
||||||
jacksonVersion =2.15.3
|
jacksonVersion =2.16.1
|
||||||
fastjsonVersion =1.2.83
|
fastjsonVersion =1.2.83
|
||||||
minidevjsonsmartVersion =2.4.5
|
minidevjsonsmartVersion =2.4.5
|
||||||
#database
|
#database
|
||||||
@ -108,7 +108,7 @@ druidspringbootstarterVersion =1.2.16
|
|||||||
jedisVersion =4.3.2
|
jedisVersion =4.3.2
|
||||||
caffeineVersion =3.1.5
|
caffeineVersion =3.1.5
|
||||||
hibernateVersion =7.0.5.Final
|
hibernateVersion =7.0.5.Final
|
||||||
mybatisVersion =3.5.14
|
mybatisVersion =3.5.15
|
||||||
mybatisspringVersion =3.0.2
|
mybatisspringVersion =3.0.2
|
||||||
mybatisjpaextraVersion =3.2
|
mybatisjpaextraVersion =3.2
|
||||||
#saml
|
#saml
|
||||||
|
|||||||
@ -17,17 +17,15 @@
|
|||||||
|
|
||||||
package org.dromara.maxkey.util;
|
package org.dromara.maxkey.util;
|
||||||
|
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.nio.file.Paths;
|
||||||
|
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
public class PathUtils {
|
public class PathUtils {
|
||||||
private static final Logger _logger = LoggerFactory.getLogger(PathUtils.class);
|
static final Logger _logger = LoggerFactory.getLogger(PathUtils.class);
|
||||||
private static PathUtils instance = null;
|
static PathUtils instance = null;
|
||||||
private String classPath;
|
String appPath;
|
||||||
private String appPath;
|
|
||||||
public static String WEB_INFO = "/WEB-INF/";
|
|
||||||
private static final String PATH_FILE_NAME = "PathUtils.properties";
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* getInstance .
|
* getInstance .
|
||||||
@ -45,56 +43,15 @@ public class PathUtils {
|
|||||||
* PathUtils.
|
* PathUtils.
|
||||||
*/
|
*/
|
||||||
public PathUtils() {
|
public PathUtils() {
|
||||||
try {
|
appPath =System.getProperty("user.dir");
|
||||||
classPath = java.net.URLDecoder.decode(
|
if(StringUtils.isBlank(appPath)) {
|
||||||
PathUtils.class.getResource(PATH_FILE_NAME).getFile(),
|
appPath = Paths.get("").toAbsolutePath().toString();
|
||||||
"UTF-8"
|
|
||||||
);
|
|
||||||
_logger.trace("PathUtils() PathUtils " + classPath);
|
|
||||||
} catch (UnsupportedEncodingException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String fileProtocol = PathUtils.class.getResource(PATH_FILE_NAME).getProtocol();
|
|
||||||
_logger.trace("Properties Protocol:"
|
|
||||||
+ PathUtils.class.getResource("PathUtils.properties").getProtocol());
|
|
||||||
|
|
||||||
if (fileProtocol.equalsIgnoreCase("file") && classPath.indexOf("file:") == 0) {
|
|
||||||
classPath = classPath.substring(5, classPath.length());
|
|
||||||
} else if (fileProtocol.equalsIgnoreCase("jar") && classPath.indexOf("file:") == 0) {
|
|
||||||
// file:/Server/webapps/app
|
|
||||||
classPath = classPath.substring(5, classPath.length());
|
|
||||||
} else if (fileProtocol.equalsIgnoreCase("wsjar") && classPath.indexOf("file:") == 0) {
|
|
||||||
classPath = classPath.substring(5, classPath.length());
|
|
||||||
} else if (classPath.equalsIgnoreCase("file:")) {
|
|
||||||
classPath = classPath.substring(5, classPath.length());
|
|
||||||
}
|
|
||||||
|
|
||||||
_logger.trace("PathUtils Class Path : " + classPath);
|
|
||||||
classPath = classPath.substring(0,
|
|
||||||
classPath.indexOf("/org/dromara/maxkey/util/" + PATH_FILE_NAME));
|
|
||||||
if (classPath.indexOf(WEB_INFO) == -1) {
|
|
||||||
appPath = classPath.substring(0, classPath.lastIndexOf("/"));
|
|
||||||
} else {
|
|
||||||
appPath = classPath.substring(0, classPath.lastIndexOf(WEB_INFO));
|
|
||||||
}
|
|
||||||
|
|
||||||
System.setProperty("APP_PATH", appPath);
|
System.setProperty("APP_PATH", appPath);
|
||||||
System.setProperty("CLASSES_PATH", classPath);
|
_logger.trace("PathUtils App Path : {} " ,appPath);
|
||||||
|
|
||||||
_logger.trace("PathUtils App Path : " + appPath);
|
|
||||||
_logger.trace("PathUtils Class Path : " + classPath);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getAppPath() {
|
public String getAppPath() {
|
||||||
return appPath + "/";
|
return appPath;
|
||||||
}
|
|
||||||
|
|
||||||
public String getClassPath() {
|
|
||||||
return classPath + "/";
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getWebInf() {
|
|
||||||
return (classPath.lastIndexOf(WEB_INFO) > -1) ? (appPath + WEB_INFO) : "";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1 +0,0 @@
|
|||||||
org.maxkey.util.PathUtils
|
|
||||||
Loading…
x
Reference in New Issue
Block a user