Commit 24076df5 authored by tangwei's avatar tangwei

修改代码检测错误

parent 30de84de
...@@ -17,6 +17,7 @@ import org.springframework.context.ConfigurableApplicationContext; ...@@ -17,6 +17,7 @@ import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.core.env.Environment; import org.springframework.core.env.Environment;
import org.springframework.data.redis.connection.RedisConnection; import org.springframework.data.redis.connection.RedisConnection;
import org.springframework.data.redis.connection.RedisConnectionFactory;
import org.springframework.data.redis.core.RedisTemplate; import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.scheduling.annotation.EnableAsync; import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
...@@ -53,9 +54,8 @@ public class AmosJcsApplication { ...@@ -53,9 +54,8 @@ public class AmosJcsApplication {
String port = env.getProperty("server.port"); String port = env.getProperty("server.port");
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path")); String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path"));
GlobalExceptionHandler.setAlwaysOk(true); GlobalExceptionHandler.setAlwaysOk(true);
logger.info("\n----------------------------------------------------------\n\t" String logs=String.format("%n----------------------------------------------------------%n Application Amos-Biz-Boot is running! Access URLs:%n Swagger文档: http:// %c : %c %c /doc.html%n----------------------------------------------------------",ip,port,path);
+ "Application Amos-Biz-Boot is running! Access URLs:\n\t" + "Swagger文档: \thttp://" + ip + ":" + port logger.info( logs);
+ path + "/doc.html\n" + "----------------------------------------------------------");
} }
/** /**
...@@ -71,12 +71,18 @@ public class AmosJcsApplication { ...@@ -71,12 +71,18 @@ public class AmosJcsApplication {
RedisTemplate redisTemplate = context.getBean("redisTemplate", RedisTemplate.class); RedisTemplate redisTemplate = context.getBean("redisTemplate", RedisTemplate.class);
RedisConnection redisConnection = null; RedisConnection redisConnection = null;
try { try {
redisConnection = redisTemplate.getConnectionFactory().getConnection(); RedisConnectionFactory redisConnectionFactory=redisTemplate.getConnectionFactory();
redisConnection.flushAll(); if(redisConnectionFactory!=null){
redisConnection = redisConnectionFactory.getConnection();
redisConnection.flushAll();
}
} catch (Exception e) { } catch (Exception e) {
logger.info("删除redis 缓存的key 失败"); logger.info("删除redis 缓存的key 失败");
} finally { } finally {
redisConnection.close(); if(redisConnection!=null){
redisConnection.close();
}
} }
} }
......
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