Commit 0f3bcc55 authored by KeYong's avatar KeYong

Merge branch 'develop_dl_bugfix' of http://36.40.66.175:5000/moa/amos-boot-biz…

Merge branch 'develop_dl_bugfix' of http://36.40.66.175:5000/moa/amos-boot-biz into develop_dl_bugfix
parents c724a94c b4b9ec61
package com.yeejoin.amos.boot.module.common.api.interceptor;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.*;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Component;
import org.springframework.util.ReflectionUtils;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Properties;
@Component
// 标志该类是一个拦截器
// {@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})}
@Intercepts({
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}),
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class}),
}
)
public class PluginInterceptor implements Interceptor {
/**
* 进行拦截的时候要执行的方法
*
* @param invocation
* @return
* @throws Throwable
*/
public Object intercept(Invocation invocation) throws Throwable {
System.out.println("====intercept======");
Object[] args = invocation.getArgs();
MappedStatement mappedStatement = (MappedStatement) args[0];
Object parameter = args[1];
RowBounds rowBounds = (RowBounds) args[2];
ResultHandler resultHandler = (ResultHandler) args[3];
Executor executor = (Executor) invocation.getTarget();
CacheKey cacheKey;
BoundSql boundSql;
//由于逻辑关系,只会进入一次
if (args.length == 4) {
//4 个参数时
boundSql = mappedStatement.getBoundSql(parameter);
cacheKey = executor.createCacheKey(mappedStatement, parameter, rowBounds, boundSql);
} else {
//6 个参数时
cacheKey = (CacheKey) args[4];
boundSql = (BoundSql) args[5];
}
//id为执行的mapper方法的全路径名,如com.metro.dao.UserMapper.insertUser
String id = mappedStatement.getId();
//获取到原始sql语句
String sql = boundSql.getSql();
if ("com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper.selectPersonListCount".equals(id) ||
"com.yeejoin.amos.boot.module.common.api.mapper.OrgUsrMapper.selectPersonList".equals(id)) {
HashMap par = new HashMap();
if (parameter instanceof HashMap) {
par = (HashMap) ((HashMap<?, ?>) parameter).get("map");
}
LinkedHashMap<String, String> fieldsValue = (LinkedHashMap<String, String>) par.get("fieldsValue");
Iterator<String> iterator = fieldsValue.keySet().stream().iterator();
while (iterator.hasNext()) {
String next = iterator.next();
sql = sql.replaceFirst("item", next).replaceFirst("ietmValue", new StringBuffer().append("'").append(fieldsValue.get(next)).append("'").toString());
}
//通过反射修改sql语句
Field field = boundSql.getClass().getDeclaredField("sql");
ReflectionUtils.makeAccessible(field);
field.set(boundSql, sql);
return executor.query(mappedStatement, parameter, rowBounds, resultHandler, cacheKey, boundSql);
} else {
return invocation.proceed();
}
}
public Object plugin(Object target) {
System.out.println("-----------------------------plugin-------------------------");
return Plugin.wrap(target, this);
}
public void setProperties(Properties properties) {
System.out.println("====setProperties======");
}
}
\ No newline at end of file
package com.yeejoin.equipmanage.common.interceptor;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.*;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Component;
import org.springframework.util.ReflectionUtils;
import java.lang.reflect.Field;
import java.util.HashMap;
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Properties;
@Component
// 标志该类是一个拦截器
// {@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})}
@Intercepts({
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}),
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class}),
}
)
public class PluginInterceptor implements Interceptor {
/**
* 进行拦截的时候要执行的方法
*
* @param invocation
* @return
* @throws Throwable
*/
public Object intercept(Invocation invocation) throws Throwable {
System.out.println("====intercept======");
Object[] args = invocation.getArgs();
MappedStatement mappedStatement = (MappedStatement) args[0];
Object parameter = args[1];
RowBounds rowBounds = (RowBounds) args[2];
ResultHandler resultHandler = (ResultHandler) args[3];
Executor executor = (Executor) invocation.getTarget();
CacheKey cacheKey;
BoundSql boundSql;
//由于逻辑关系,只会进入一次
if (args.length == 4) {
//4 个参数时
boundSql = mappedStatement.getBoundSql(parameter);
cacheKey = executor.createCacheKey(mappedStatement, parameter, rowBounds, boundSql);
} else {
//6 个参数时
cacheKey = (CacheKey) args[4];
boundSql = (BoundSql) args[5];
}
//id为执行的mapper方法的全路径名,如com.metro.dao.UserMapper.insertUser
String id = mappedStatement.getId();
//获取到原始sql语句
String sql = boundSql.getSql();
if ("com.yeejoin.equipmanage.mapper.FormInstanceMapper.queryForMapList".equals(id)) {
//执行结果
HashMap<String, String> par = new LinkedHashMap<>();
if (parameter instanceof HashMap) {
par = (HashMap<String, String>) ((HashMap<?, ?>) parameter).get("params");
}
Iterator<String> iterator = par.keySet().stream().iterator();
while (iterator.hasNext()) {
String next = iterator.next();
sql = sql.replace("item", next);
}
//通过反射修改sql语句
Field field = boundSql.getClass().getDeclaredField("sql");
ReflectionUtils.makeAccessible(field);
field.set(boundSql, sql);
return executor.query(mappedStatement, parameter, rowBounds, resultHandler, cacheKey, boundSql);
} else {
return invocation.proceed();
}
}
public Object plugin(Object target) {
System.out.println("-----------------------------plugin-------------------------");
return Plugin.wrap(target, this);
}
public void setProperties(Properties properties) {
System.out.println("====setProperties======");
}
}
\ No newline at end of file
......@@ -1170,10 +1170,9 @@ public class OrgUsrController extends BaseController {
//9891 按照测试要求转成人员管理信息且按换流站过滤
List<Map> map = new ArrayList<>();
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
objects.stream().forEach(e->{
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
OrgUsr orgUsr = orgUsrMapper.queryByUserId(Long.valueOf(e.get("userId").toString()));
if (!ObjectUtils.isEmpty(orgUsr) && orgUsr.getBizOrgCode().startsWith(bizOrgCode)){
e.put("realName",orgUsr.getBizOrgName());
......
......@@ -182,6 +182,8 @@ public class DutyCarServiceImpl extends DutyCommonServiceImpl implements IDutyCa
String[] instanceIds = instanceId.split(",");
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKey);
// 获取当前装备ID下的排版数据
List<Map<String, Object>> specifyDateList = dutyPersonShiftMapper.getPositionStaffDutyForSpecifyDate(dutyDay,
this.getGroupCode(), instanceIds,null, fieldCode);
......
......@@ -17,15 +17,15 @@ import java.util.Map;
*/
public interface IFormInstanceService extends IService<FormInstance> {
/**
* 分页查询
*
* @param groupCode 分组编号
* @param current 当前页
* @param size 页面大小
* @return Page
*/
Page<Map<String, Object>> queryForInstancePage(String groupCode, long current, long size);
// /**
// * 分页查询
// *
// * @param groupCode 分组编号
// * @param current 当前页
// * @param size 页面大小
// * @return Page
// */
// Page<Map<String, Object>> queryForInstancePage(String groupCode, long current, long size);
/**
* 创建
......
......@@ -387,10 +387,10 @@ public class BuildingServiceImpl extends ServiceImpl<BuildingMapper, Building> i
@Override
@Transactional(rollbackFor = {Exception.class, BaseException.class})
public Object updateForm(Long instanceId, String orgCode, Map<String, Object> map, String groupCode) {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKeyEnable);
if (StringUtil.isNotEmpty(groupCode)) {
map.keySet().forEach(x -> {
// 权限处理
PermissionInterceptorContext.setDataAuthRule(authKeyEnable);
formInstanceMapper.updateFormFieldValue(instanceId, x, String.valueOf(map.get(x)));
});
return CommonResponseUtil.success();
......
......@@ -379,8 +379,6 @@ public class EquipmentSpecificSerivceImpl extends ServiceImpl<EquipmentSpecificM
@Value("${equipment.pressurepump.start}")
private String pressurePumpStart;
@Value("${auth-key-auth-enabled:}")
private String authKey;
private StockBill buildStockBills(EquipmentSpecific equipmentSpecific, ReginParams reginParams, AgencyUserModel agencyUserModel) {
StockBill stockBill = new StockBill();
......
......@@ -361,37 +361,37 @@ public class FormInstanceServiceImpl extends ServiceImpl<FormInstanceMapper, For
return formInstanceMapper.getFormInstanceById(instanceId);
}
@Override
public Page queryForInstancePage(String groupCode, long current, long size) {
List<FormGroupColumn> optionList = iFormGroupColumnService.queryByGroup(groupCode);
Map<String, String[]> parameterMap = request.getParameterMap();
//说明:parameterMap 为静态map 不可修改,所以需要深拷贝
Map<String, String[]> localMap = new HashMap<>();
localMap.putAll(parameterMap);
localMap.remove("current");
localMap.remove("size");
Map<String, String> params = new HashMap<>();
if (!ValidationUtil.isEmpty(localMap)) {
for (String key : localMap.keySet()) {
if (!ValidationUtil.isEmpty(localMap.get(key))) {
params.put(key, localMap.get(key)[0]);
}
}
}
Page page = new Page();
page.setCurrent(current);
page.setSize(size);
Map<String, Object> fieldNames = Bean.listToMap(optionList, "fieldName", "queryStrategy", FormGroupColumn.class);
Page<Map<String, Object>> resultList = this.getBaseMapper().queryInstancePage(page, groupCode, fieldNames, params);
if (!ValidationUtil.isEmpty(resultList)) {
for (FormGroupColumn optionModel : optionList) {
for (Map<String, Object> instanceMap : resultList.getRecords()) {
instanceMap.put(optionModel.getFieldName(), this.dataTypeProcess(optionModel.getFieldName(), instanceMap.get(optionModel.getFieldName()), optionModel.getDataType(), instanceMap));
}
}
}
return resultList;
}
// @Override
// public Page queryForInstancePage(String groupCode, long current, long size) {
// List<FormGroupColumn> optionList = iFormGroupColumnService.queryByGroup(groupCode);
// Map<String, String[]> parameterMap = request.getParameterMap();
// //说明:parameterMap 为静态map 不可修改,所以需要深拷贝
// Map<String, String[]> localMap = new HashMap<>();
// localMap.putAll(parameterMap);
// localMap.remove("current");
// localMap.remove("size");
// Map<String, String> params = new HashMap<>();
// if (!ValidationUtil.isEmpty(localMap)) {
// for (String key : localMap.keySet()) {
// if (!ValidationUtil.isEmpty(localMap.get(key))) {
// params.put(key, localMap.get(key)[0]);
// }
// }
// }
// Page page = new Page();
// page.setCurrent(current);
// page.setSize(size);
// Map<String, Object> fieldNames = Bean.listToMap(optionList, "fieldName", "queryStrategy", FormGroupColumn.class);
// Page<Map<String, Object>> resultList = this.getBaseMapper().queryInstancePage(page, groupCode, fieldNames, params);
// if (!ValidationUtil.isEmpty(resultList)) {
// for (FormGroupColumn optionModel : optionList) {
// for (Map<String, Object> instanceMap : resultList.getRecords()) {
// instanceMap.put(optionModel.getFieldName(), this.dataTypeProcess(optionModel.getFieldName(), instanceMap.get(optionModel.getFieldName()), optionModel.getDataType(), instanceMap));
// }
// }
// }
// return resultList;
// }
@Override
public List<Map<String, Object>> queryForMapList(String groupCode, Map<String, String> params) {
......
package com.yeejoin.amos.knowledgebase.interceptor;
import org.apache.ibatis.cache.CacheKey;
import org.apache.ibatis.executor.Executor;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;
import org.apache.ibatis.plugin.*;
import org.apache.ibatis.session.ResultHandler;
import org.apache.ibatis.session.RowBounds;
import org.springframework.stereotype.Component;
import org.springframework.util.ReflectionUtils;
import java.lang.reflect.Field;
import java.util.*;
@Component
// 标志该类是一个拦截器
// {@Signature(type = StatementHandler.class, method = "prepare", args = {Connection.class, Integer.class})}
@Intercepts({
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class}),
@Signature(type = Executor.class, method = "query", args = {MappedStatement.class, Object.class, RowBounds.class, ResultHandler.class, CacheKey.class, BoundSql.class}),
}
)
public class PluginInterceptor implements Interceptor {
/**
* 进行拦截的时候要执行的方法
* @param invocation
* @return
* @throws Throwable
*/
public Object intercept(Invocation invocation) throws Throwable {
System.out.println("====intercept======");
Object[] args = invocation.getArgs();
MappedStatement mappedStatement = (MappedStatement) args[0];
Object parameter = args[1];
RowBounds rowBounds = (RowBounds) args[2];
ResultHandler resultHandler = (ResultHandler) args[3];
Executor executor = (Executor) invocation.getTarget();
CacheKey cacheKey;
BoundSql boundSql;
//由于逻辑关系,只会进入一次
if (args.length == 4) {
//4 个参数时
boundSql = mappedStatement.getBoundSql(parameter);
cacheKey = executor.createCacheKey(mappedStatement, parameter, rowBounds, boundSql);
} else {
//6 个参数时
cacheKey = (CacheKey) args[4];
boundSql = (BoundSql) args[5];
}
//id为执行的mapper方法的全路径名,如com.metro.dao.UserMapper.insertUser
String id = mappedStatement.getId();
//获取到原始sql语句
String sql = boundSql.getSql();
if("com.yeejoin.amos.knowledgebase.face.orm.dao.DocContentMapper.queryDocBaseInfoList".equals(id)) {
//执行结果
HashMap<String,Object> par = new LinkedHashMap<>();
if(parameter instanceof HashMap) {
par = (HashMap<String, Object>) parameter;
}
List<String> extraFields = (ArrayList< String>) par.get("extraFields");
List<String> extraStrFilters = (ArrayList<String>) par.get("extraStrFilters");
for (String field : extraFields) {
sql = sql.replaceFirst("_field", field);
}
for (String filter : extraStrFilters) {
sql = sql.replaceFirst("_str", filter);
}
//通过反射修改sql语句
Field field = boundSql.getClass().getDeclaredField("sql");
ReflectionUtils.makeAccessible(field);
field.set(boundSql, sql);
return executor.query(mappedStatement, parameter, rowBounds, resultHandler, cacheKey, boundSql);
} else {
return invocation.proceed();
}
}
public Object plugin(Object target) {
System.out.println("-----------------------------plugin-------------------------");
return Plugin.wrap(target, this);
}
public void setProperties(Properties properties) {
System.out.println("====setProperties======");
}
}
\ No newline at end of file
......@@ -49,9 +49,8 @@ public class AmoCCSApplication {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment);
ConfigurableApplicationContext context = SpringApplication.run(AmoCCSApplication.class, args);
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
application.run();
String appName = environment.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
......
......@@ -40,16 +40,16 @@ import java.util.Collections;
@EnableConfigurationProperties
@EnableDiscoveryClient
@MapperScan({ "org.typroject.tyboot.demo.face.orm.dao*", "org.typroject.tyboot.face.*.orm.dao*",
"org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*",
"com.yeejoin.amos.boot.module.*.api.mapper", "com.yeejoin.amos.boot.biz.common.dao.mapper",
"com.yeejoin.equipmanage.mapper"})
"org.typroject.tyboot.core.auth.face.orm.dao*", "org.typroject.tyboot.component.*.face.orm.dao*",
"com.yeejoin.amos.boot.module.*.api.mapper", "com.yeejoin.amos.boot.biz.common.dao.mapper",
"com.yeejoin.equipmanage.mapper"})
@ComponentScan(value = {"org.typroject", "com.yeejoin.amos", "com.yeejoin.equipmanage"}, excludeFilters = {
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler.class})})
@ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {org.typroject.tyboot.core.restful.exception.GlobalExceptionHandler.class})})
@EnableFeignClients
@EnableAsync(proxyTargetClass = true)
public class AmostEquipApplication {
private static final Logger logger = LoggerFactory.getLogger(AmostEquipApplication.class);
private static final Logger logger = LoggerFactory.getLogger(AmostEquipApplication.class);
//是否走江西电建的车辆监听器,默认不走,如果在配置文件中添加了该配置且配置的值不为false
@Value("${jxiop.carIotNewListener.enable:false}")
private String jxiop;
......@@ -63,17 +63,16 @@ public class AmostEquipApplication {
@Autowired
private CarIotNewListener carIotNewListener;
public static void main(String[] args) throws UnknownHostException {
public static void main(String[] args) throws UnknownHostException {
SpringApplication application = new SpringApplication(AmostEquipApplication.class);
ConfigurableEnvironment environment = new StandardEnvironment();
int randomClientId = new SecureRandom().nextInt(65536 - 1024) + 1024;
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment);
ConfigurableApplicationContext context = SpringApplication.run(AmostEquipApplication.class, args);
application.run();
String appName = environment.getProperty("spring.application.name");
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
......
......@@ -79,10 +79,9 @@ public class FireAutoSysApplication implements ApplicationContextAware {
Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment);
logger.info("start Service..........");
ConfigurableApplicationContext context = SpringApplication.run(FireAutoSysApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
application.run();
String appName = environment.getProperty("spring.application.name");
GlobalExceptionHandler.setAlwaysOk(true);
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
......
......@@ -58,10 +58,10 @@ public class AmosJcsApplication {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment);
ConfigurableApplicationContext context = SpringApplication.run(AmosJcsApplication.class, args);
Environment env = context.getEnvironment();
delKey(env, context);// 添加全部清空redis缓存的方法 2021-09-09
String appName = env.getProperty("spring.application.name");
ConfigurableApplicationContext run = application.run();
String appName = environment.getProperty("spring.application.name");
delKey(environment, run);// 添加全部清空redis缓存的方法 2021-09-09
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
......
......@@ -48,10 +48,11 @@ public class KnowledgebaseApplication {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment);
ConfigurableApplicationContext context = new SpringApplicationBuilder(KnowledgebaseApplication.class).web(WebApplicationType.SERVLET).run(args);
ConfigurableApplicationContext run = application.run();
String appName = environment.getProperty("spring.application.name");
// ConfigurableApplicationContext context = new SpringApplicationBuilder(KnowledgebaseApplication.class).web(WebApplicationType.SERVLET).run(args);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
......
......@@ -84,7 +84,7 @@
(SELECT kdc.CATEGORY_NAME FROM knowledge_doc_category kdc WHERE kdc.SEQUENCE_NBR = DIRECTORY_ID) directoryName,
<if test="extraFields != null and extraFields.size > 0">
<foreach collection="extraFields" item="_field" >
${_field},
_field,
</foreach>
</if>
IFNULL(collectNum, 0) collectNum, IFNULL(quoteNum, 0) quoteNum, IFNULL(collect, "UNCOLLECT") collect
......@@ -157,7 +157,7 @@
ORG_CODE LIKE CONCAT(#{permissionFilters.orgCode}, "%")
AND AUDIT_STATUS IN
<foreach collection="permissionFilters.auditStatusList" item="auditStatus" open="(" close=")" separator=", ">
${auditStatus}
#{auditStatus}
</foreach>
)
</if>
......@@ -166,7 +166,7 @@
</if>
<if test="extraStrFilters != null and extraStrFilters.size > 0">
<foreach collection="extraStrFilters" item="str">
AND ${str}
AND _str
</foreach>
</if>
</where>
......
......@@ -79,9 +79,8 @@ public class LatentDangerApplication {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment);
ConfigurableApplicationContext context = SpringApplication.run(LatentDangerApplication.class, args);
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
application.run();
String appName = environment.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
......
......@@ -77,10 +77,9 @@ public class MaintenanceApplication {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment);
ConfigurableApplicationContext context = SpringApplication.run(MaintenanceApplication.class, args);
application.run();
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
String appName = environment.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
......
......@@ -93,10 +93,9 @@ public class PatrolApplication {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment);
ConfigurableApplicationContext context = SpringApplication.run(PatrolApplication.class, args);
application.run();
String appName = environment.getProperty("spring.application.name");
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
......
......@@ -77,7 +77,7 @@ public class StartPrecontrolService {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment);
SpringApplication.run(StartPrecontrolService.class, args).getEnvironment();
application.run();
log.info("swagger:--->http://localhost:8060/precontrol/swagger-ui.html");
}
......
......@@ -83,10 +83,9 @@ public class SupervisionApplication {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment);
ConfigurableApplicationContext context = SpringApplication.run(SupervisionApplication.class, args);
GlobalExceptionHandler.setAlwaysOk(true);
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
application.run();
String appName = environment.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
......
......@@ -49,10 +49,8 @@ public class AmosBootUtilsMessageApplication {
environment.getPropertySources().addFirst(new MapPropertySource("securityRandomSource",
Collections.singletonMap("security-random-int", randomClientId)));
application.setEnvironment(environment);
ConfigurableApplicationContext context = SpringApplication.run(AmosBootUtilsMessageApplication.class, args);
Environment env = context.getEnvironment();
String appName = env.getProperty("spring.application.name");
application.run();
String appName = environment.getProperty("spring.application.name");
logger.info(
"\n----------------------------------------------------------\n\t"
+ "Application {} is running!\n"
......
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