mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-15 04:52:09 +08:00
mybatis-jpa-extra
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright [2020] [MaxKey of copyright http://www.maxkey.top]
|
||||
* Copyright [2022] [MaxKey of copyright http://www.maxkey.top]
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -18,6 +18,7 @@
|
||||
package org.maxkey.web;
|
||||
|
||||
import java.sql.Connection;
|
||||
import java.sql.DatabaseMetaData;
|
||||
import java.sql.SQLException;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
@@ -29,8 +30,10 @@ import javax.servlet.http.HttpServlet;
|
||||
|
||||
import org.apache.commons.lang.SystemUtils;
|
||||
import org.apache.commons.lang3.ArchUtils;
|
||||
import org.apache.mybatis.jpa.util.JpaWebContext;
|
||||
import org.joda.time.DateTime;
|
||||
import org.maxkey.configuration.ApplicationConfig;
|
||||
import org.maxkey.crypto.Md5Sum;
|
||||
import org.maxkey.util.PathUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -64,7 +67,7 @@ public class InitializeContext extends HttpServlet {
|
||||
|
||||
WebContext.applicationContext = applicationContext;
|
||||
|
||||
org.apache.mybatis.jpa.util.WebContext.applicationContext = applicationContext;
|
||||
JpaWebContext.applicationContext = applicationContext;
|
||||
|
||||
// List Environment Variables
|
||||
listEnvVars();
|
||||
@@ -110,7 +113,7 @@ public class InitializeContext extends HttpServlet {
|
||||
((javax.sql.DataSource) applicationContext.getBean("dataSource"))
|
||||
.getConnection();
|
||||
|
||||
java.sql.DatabaseMetaData databaseMetaData = connection.getMetaData();
|
||||
DatabaseMetaData databaseMetaData = connection.getMetaData();
|
||||
ApplicationConfig.databaseProduct = databaseMetaData.getDatabaseProductName();
|
||||
|
||||
_logger.debug("DatabaseProductName : {}",
|
||||
@@ -142,6 +145,9 @@ public class InitializeContext extends HttpServlet {
|
||||
_logger.debug("UserName : {}" ,
|
||||
databaseMetaData.getUserName());
|
||||
_logger.debug("-----------------------------------------------------------");
|
||||
if(Md5Sum.checkVersion()) {
|
||||
_logger.trace("The Version dependent on is Reliable .");
|
||||
}
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
_logger.error("DatabaseMetaData Variables Error .",e);
|
||||
@@ -164,11 +170,13 @@ public class InitializeContext extends HttpServlet {
|
||||
.getAppliedPropertySources()
|
||||
.get(PropertySourcesPlaceholderConfigurer.ENVIRONMENT_PROPERTIES_PROPERTY_SOURCE_NAME)
|
||||
.getSource();
|
||||
|
||||
|
||||
Iterator<PropertySource<?>> it =WebContext.properties.getPropertySources().iterator();
|
||||
while(it.hasNext()) {
|
||||
_logger.debug("propertySource {}" , it.next());
|
||||
}
|
||||
|
||||
JpaWebContext.properties = WebContext.properties;
|
||||
_logger.trace("-----------------------------------------------------------");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,9 +20,8 @@ package org.maxkey.web;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import org.apache.commons.lang.SystemUtils;
|
||||
import org.joda.time.DateTime;
|
||||
import org.maxkey.constants.ContentType;
|
||||
import org.apache.mybatis.jpa.util.JpaWebContext;
|
||||
import org.springframework.stereotype.Controller;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
@@ -34,32 +33,6 @@ public class MetadataEndpoint {
|
||||
@RequestMapping(value = "/metadata/version",produces = ContentType.TEXT_PLAIN_UTF8, method={RequestMethod.GET})
|
||||
@ResponseBody
|
||||
public String metadata(HttpServletRequest request,HttpServletResponse response) {
|
||||
StringBuffer version =
|
||||
new StringBuffer("---------------------------------------------------------------------------------\n");
|
||||
version.append("+ MaxKey \n");
|
||||
version.append("+ Single Sign On ( SSO ) \n");
|
||||
version.append("+ Version ");
|
||||
version.append(WebContext.properties.getProperty("application.formatted-version")+"\n");
|
||||
version.append("+\n");
|
||||
version.append(String.format("+ %sCopyright 2018 - %s https://www.maxkey.top/\n",
|
||||
(char)0xA9 , new DateTime().getYear()
|
||||
));
|
||||
version.append("+ Licensed under the Apache License, Version 2.0 \n");
|
||||
|
||||
|
||||
version.append("---------------------------------------------------------------------------------\n");
|
||||
version.append("+ JAVA \n");
|
||||
version.append(String.format("+ %s java version %s, class %s\n",
|
||||
SystemUtils.JAVA_VENDOR,
|
||||
SystemUtils.JAVA_VERSION,
|
||||
SystemUtils.JAVA_CLASS_VERSION
|
||||
));
|
||||
version.append(String.format("+ %s (build %s, %s)\n",
|
||||
SystemUtils.JAVA_VM_NAME,
|
||||
SystemUtils.JAVA_VM_VERSION,
|
||||
SystemUtils.JAVA_VM_INFO
|
||||
));
|
||||
version.append("---------------------------------------------------------------------------------\n");
|
||||
return version.toString();
|
||||
return JpaWebContext.version();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user