Browse Source

新增:GlobalFilter,tomcat容器级别,用于ThreadLocal变量残留清除

dev_shibei_match
wxz 4 years ago
parent
commit
323eafcca5
  1. 2
      epmet-admin/epmet-admin-server/src/main/java/com/epmet/AdminApplication.java
  2. 2
      epmet-auth/src/main/java/com/epmet/AuthApplication.java
  3. 90
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ThreadLocalInitAspect.java
  4. 30
      epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/GlobalFilter.java
  5. 2
      epmet-gateway/src/main/java/com/epmet/GatewayApplication.java
  6. 2
      epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/DataAggregatorApplication.java
  7. 2
      epmet-module/data-report/data-report-server/src/main/java/com/epmet/DataReportApplication.java
  8. 2
      epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/DataStatsApplication.java
  9. 2
      epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/ActivitiApplication.java
  10. 2
      epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/EpmetCommonServiceApplication.java
  11. 2
      epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/DemoApplication.java
  12. 2
      epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/EpmetExtApplication.java
  13. 2
      epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/EpmetHeartApplication.java
  14. 2
      epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/JobApplication.java
  15. 2
      epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/MessageApplication.java
  16. 2
      epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/OssApplication.java
  17. 2
      epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/EpmetPointApplication.java
  18. 2
      epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/EpmetThirdApplication.java
  19. 16
      epmet-module/gov-access/gov-access-server/pom.xml
  20. 2
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/GovAccessApplication.java
  21. 20
      epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/TestController.java
  22. 5
      epmet-module/gov-access/gov-access-server/src/main/resources/bootstrap.yml
  23. 18
      epmet-module/gov-access/gov-access-server/src/main/resources/logback-spring.xml
  24. 2
      epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/GovGridApplication.java
  25. 2
      epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/GovIssueApplication.java
  26. 2
      epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/GovMineApplication.java
  27. 2
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/GovOrgApplication.java
  28. 2
      epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/GovProjectApplication.java
  29. 2
      epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/GovVoiceApplication.java
  30. 2
      epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/OperAccessApplication.java
  31. 2
      epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/OperCrmApplication.java
  32. 2
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/OperCustomizeApplication.java
  33. 2
      epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/ResiGroupApplication.java
  34. 2
      epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/ResiGuideApplication.java
  35. 2
      epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/ResiHallApplication.java
  36. 2
      epmet-module/resi-home/resi-home-server/src/main/java/com/epmet/ResiHomeApplication.java
  37. 2
      epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/ResiMineApplication.java
  38. 2
      epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/ResiPartyMemberApplication.java
  39. 2
      epmet-module/resi-voice/resi-voice-server/src/main/java/com/epmet/ResiVoiceApplication.java
  40. 2
      epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/ScanApplication.java
  41. 2
      epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java

2
epmet-admin/epmet-admin-server/src/main/java/com/epmet/AdminApplication.java

@ -10,6 +10,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -22,6 +23,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class AdminApplication {
public static void main(String[] args) {

2
epmet-auth/src/main/java/com/epmet/AuthApplication.java

@ -10,6 +10,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -22,6 +23,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan // 开启Servlet容器扫描,扫描@WebFilter等注解
public class AuthApplication {
public static void main(String[] args) {

90
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/aspect/ThreadLocalInitAspect.java

@ -1,45 +1,45 @@
/**
* Copyright (c) 2018 人人开源 All rights reserved.
* <p>
* https://www.renren.io
* <p>
* 版权所有侵权必究
*/
package com.epmet.commons.tools.aspect;
import com.epmet.commons.tools.constant.ThreadLocalConstant;
import com.epmet.commons.tools.dto.form.LoginUserInfoResultDTO;
import com.epmet.commons.tools.exception.ExceptionUtils;
import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;
/**
* 每次请求清理ThreadLocal线程中的变量
* @Author wxz
* @Description
* @Date 2020/4/23 16:16
**/
@Aspect
@Component
@Order(1)
public class ThreadLocalInitAspect {
private static final Logger log = LoggerFactory.getLogger(ThreadLocalInitAspect.class);
@Before(value = "execution(* com.epmet.controller.*Controller*.*(..)) ")
public void before(JoinPoint point) throws Throwable {
// 清理权限过滤中的变量残留
try {
ThreadLocalConstant.sqlFilter.remove();
ThreadLocalConstant.requirePermissionTl.remove();
} catch (Exception e) {
log.error("清理sqlFilter缓存失败:{}", ExceptionUtils.getErrorStackTrace(e));
}
}
}
///**
// * Copyright (c) 2018 人人开源 All rights reserved.
// * <p>
// * https://www.renren.io
// * <p>
// * 版权所有,侵权必究!
// */
//
//package com.epmet.commons.tools.aspect;
//
//import com.epmet.commons.tools.constant.ThreadLocalConstant;
//import com.epmet.commons.tools.dto.form.LoginUserInfoResultDTO;
//import com.epmet.commons.tools.exception.ExceptionUtils;
//import org.aspectj.lang.JoinPoint;
//import org.aspectj.lang.annotation.Aspect;
//import org.aspectj.lang.annotation.Before;
//import org.slf4j.Logger;
//import org.slf4j.LoggerFactory;
//import org.springframework.core.annotation.Order;
//import org.springframework.stereotype.Component;
//
///**
// * 每次请求,清理ThreadLocal线程中的变量(已废弃,改用GlobalFilter)
// * @Author wxz
// * @Description
// * @Date 2020/4/23 16:16
// **/
//@Aspect
//@Component
//@Order(1)
//public class ThreadLocalInitAspect {
//
// private static final Logger log = LoggerFactory.getLogger(ThreadLocalInitAspect.class);
//
// @Before(value = "execution(* com.epmet.controller.*Controller*.*(..)) ")
// public void before(JoinPoint point) throws Throwable {
// // 清理权限过滤中的变量残留
// try {
// ThreadLocalConstant.sqlFilter.remove();
// ThreadLocalConstant.requirePermissionTl.remove();
// } catch (Exception e) {
// log.error("清理sqlFilter缓存失败:{}", ExceptionUtils.getErrorStackTrace(e));
// }
// }
//}

30
epmet-commons/epmet-commons-tools/src/main/java/com/epmet/commons/tools/filter/GlobalFilter.java

@ -0,0 +1,30 @@
package com.epmet.commons.tools.filter;
import com.epmet.commons.tools.constant.ThreadLocalConstant;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;
/**
* @Description 全局过滤器可在请求结束的时候清除线程变量残留
* @author wxz
* @date 2021.07.19 10:19:24
*/
@WebFilter(value = "/*")
public class GlobalFilter implements Filter {
@Override
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain) throws IOException, ServletException {
try {
filterChain.doFilter(servletRequest, servletResponse);
} catch (Throwable e) {
throw e;
} finally {
// 清除线程变量残留
ThreadLocalConstant.sqlFilter.remove();
ThreadLocalConstant.requirePermissionTl.remove();
ThreadLocalConstant.requestParam.remove();
}
}
}

2
epmet-gateway/src/main/java/com/epmet/GatewayApplication.java

@ -11,6 +11,7 @@ package com.epmet;
import com.epmet.commons.tools.aspect.ServletExceptionHandler;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
@ -25,6 +26,7 @@ import org.springframework.context.annotation.FilterType;
@SpringBootApplication()
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
@ComponentScan(basePackages = {"com.epmet.*"}, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, classes = {ServletExceptionHandler.class}))
public class GatewayApplication {

2
epmet-module/data-aggregator/data-aggregator-server/src/main/java/com/epmet/DataAggregatorApplication.java

@ -3,12 +3,14 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication(scanBasePackages = {"com.epmet"}, exclude = {DataSourceAutoConfiguration.class})
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class DataAggregatorApplication {
public static void main(String[] args) {
SpringApplication.run(DataAggregatorApplication.class, args);

2
epmet-module/data-report/data-report-server/src/main/java/com/epmet/DataReportApplication.java

@ -2,6 +2,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync;
@ -10,6 +11,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
@EnableDiscoveryClient
@EnableFeignClients
@EnableAsync
@ServletComponentScan
public class DataReportApplication {
public static void main(String[] args) {
SpringApplication.run(DataReportApplication.class, args);

2
epmet-module/data-statistical/data-statistical-server/src/main/java/com/epmet/DataStatsApplication.java

@ -3,6 +3,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync;
@ -11,6 +12,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
@EnableFeignClients
@SpringBootApplication (exclude = {DataSourceAutoConfiguration.class})
@EnableAsync
@ServletComponentScan
public class DataStatsApplication {
public static void main(String[] args) {

2
epmet-module/epmet-activiti/epmet-activiti-server/src/main/java/com/epmet/ActivitiApplication.java

@ -10,6 +10,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -25,6 +26,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
})
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class ActivitiApplication {
public static void main(String[] args) {

2
epmet-module/epmet-common-service/common-service-server/src/main/java/com/epmet/EpmetCommonServiceApplication.java

@ -10,6 +10,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -22,6 +23,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class EpmetCommonServiceApplication {
public static void main(String[] args) {

2
epmet-module/epmet-demo/epmet-demo-server/src/main/java/com/epmet/DemoApplication.java

@ -10,6 +10,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -22,6 +23,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class DemoApplication {
public static void main(String[] args) {

2
epmet-module/epmet-ext/epmet-ext-server/src/main/java/com/epmet/EpmetExtApplication.java

@ -2,12 +2,14 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class EpmetExtApplication {
public static void main(String[] args) {

2
epmet-module/epmet-heart/epmet-heart-server/src/main/java/com/epmet/EpmetHeartApplication.java

@ -10,6 +10,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -22,6 +23,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class EpmetHeartApplication {
public static void main(String[] args) {

2
epmet-module/epmet-job/epmet-job-server/src/main/java/com/epmet/JobApplication.java

@ -10,6 +10,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -22,6 +23,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class JobApplication {
public static void main(String[] args) {

2
epmet-module/epmet-message/epmet-message-server/src/main/java/com/epmet/MessageApplication.java

@ -10,6 +10,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -22,6 +23,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class MessageApplication {
public static void main(String[] args) {

2
epmet-module/epmet-oss/epmet-oss-server/src/main/java/com/epmet/OssApplication.java

@ -10,6 +10,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -22,6 +23,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class OssApplication {
public static void main(String[] args) {

2
epmet-module/epmet-point/epmet-point-server/src/main/java/com/epmet/EpmetPointApplication.java

@ -2,6 +2,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -14,6 +15,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class EpmetPointApplication {
public static void main(String[] args) {
SpringApplication.run(EpmetPointApplication.class, args);

2
epmet-module/epmet-third/epmet-third-server/src/main/java/com/epmet/EpmetThirdApplication.java

@ -2,12 +2,14 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class EpmetThirdApplication {
public static void main(String[] args) {

16
epmet-module/gov-access/gov-access-server/pom.xml

@ -127,6 +127,10 @@
<!--flyway migration 数据库迁移工具-->
<spring.flyway.enabled>false</spring.flyway.enabled>
<!--钉钉 机器人地址-->
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4</dingTalk.robot.webHook>
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret>
</properties>
</profile>
<profile>
@ -160,6 +164,10 @@
<!--flyway migration 数据库迁移工具-->
<spring.flyway.enabled>false</spring.flyway.enabled>
<!--钉钉 机器人地址-->
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4</dingTalk.robot.webHook>
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret>
</properties>
</profile>
<profile>
@ -193,6 +201,10 @@
<!--flyway migration 数据库迁移工具-->
<spring.flyway.enabled>true</spring.flyway.enabled>
<!--钉钉 机器人地址-->
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=e894e5690f9d6a527722974c71548ff6c0fe29bd956589a09e21b16442a35ed4</dingTalk.robot.webHook>
<dingTalk.robot.secret>SECfcc020bdc83bb17a2c00f39977b1fbc409ef4188c7beaea11c5caa90eeaf87fd</dingTalk.robot.secret>
</properties>
</profile>
<profile>
@ -223,6 +235,10 @@
<!--flyway migration 数据库迁移工具-->
<spring.flyway.enabled>true</spring.flyway.enabled>
<!--生产钉钉 机器人地址-->
<dingTalk.robot.webHook>https://oapi.dingtalk.com/robot/send?access_token=a5f66c3374b1642fe2142dbf56d5997e280172d4e8f2b546c9423a68c82ece6c</dingTalk.robot.webHook>
<dingTalk.robot.secret>SEC95f4f40b533ad379ea6a6d1af6dd37029383cfe1b7cd96dfac2678be2c1c3ed1</dingTalk.robot.secret>
</properties>
</profile>
</profiles>

2
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/GovAccessApplication.java

@ -2,6 +2,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -12,6 +13,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
//@EnableConfigurationProperties(value = {DatabaseProperties.class})
public class GovAccessApplication {
public static void main(String[] args) {

20
epmet-module/gov-access/gov-access-server/src/main/java/com/epmet/controller/TestController.java

@ -1,12 +1,11 @@
package com.epmet.controller;
import com.epmet.commons.tools.annotation.ExternalRequestAuth;
import com.epmet.commons.tools.exception.RenException;
import com.epmet.service.TestService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.bind.annotation.*;
@RestController
@RequestMapping("test")
@ -16,10 +15,17 @@ public class TestController {
private TestService testService;
@ExternalRequestAuth
@GetMapping("test")
public void test() {
System.out.println("TestController -> test()");
@PostMapping("test")
public void test(@RequestBody Input input) {
if (true) {
throw new RenException("测试报错");
}
testService.test();
}
@Data
public static class Input {
private String name;
}
}

5
epmet-module/gov-access/gov-access-server/src/main/resources/bootstrap.yml

@ -124,3 +124,8 @@ pagehelper:
logging:
level:
com.epmet: debug
dingTalk:
robot:
webHook: @dingTalk.robot.webHook@
secret: @dingTalk.robot.secret@

18
epmet-module/gov-access/gov-access-server/src/main/resources/logback-spring.xml

@ -6,6 +6,9 @@
<springProperty scope="context" name="appname" source="spring.application.name"/>
<springProperty scope="context" name="webHook" source="dingTalk.robot.webHook"/>
<springProperty scope="context" name="secret" source="dingTalk.robot.secret"/>
<!-- 日志上下文名称 -->
<contextName>${appname}</contextName>
@ -125,16 +128,25 @@
<!--日志文档保留天数-->
<maxHistory>15</maxHistory>
</rollingPolicy>
<!-- 此日志文档只记录ERROR级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 此日志文档只记录ERROR级别的 发送钉钉短信 -->
<filter class="com.epmet.commons.tools.filter.LogMsgSendFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
<webHook>${webHook}</webHook>
<secret>${secret}</secret>
<appName>${appname}</appName>
</filter>
<!-- 此日志文档只记录ERROR级别的 -->
<!--<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>-->
</appender>
<!-- 开发、测试环境 -->
<springProfile name="dev,test">
<springProfile name="dev,test,local">
<logger name="org.springframework.web" level="INFO"/>
<logger name="org.springboot.sample" level="INFO"/>
<logger name="com.epmet.dao" level="INFO"/>

2
epmet-module/gov-grid/gov-grid-server/src/main/java/com/epmet/GovGridApplication.java

@ -2,6 +2,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -14,6 +15,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class GovGridApplication {
public static void main(String[] args) {

2
epmet-module/gov-issue/gov-issue-server/src/main/java/com/epmet/GovIssueApplication.java

@ -2,6 +2,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -13,6 +14,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class GovIssueApplication {
public static void main(String[] args) {
SpringApplication.run(GovIssueApplication.class, args);

2
epmet-module/gov-mine/gov-mine-server/src/main/java/com/epmet/GovMineApplication.java

@ -2,12 +2,14 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class GovMineApplication {
public static void main(String[] args) {

2
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/GovOrgApplication.java

@ -10,6 +10,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -22,6 +23,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class GovOrgApplication {
public static void main(String[] args) {

2
epmet-module/gov-project/gov-project-server/src/main/java/com/epmet/GovProjectApplication.java

@ -2,6 +2,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -13,6 +14,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class GovProjectApplication {
public static void main(String[] args) {
SpringApplication.run(GovProjectApplication.class, args);

2
epmet-module/gov-voice/gov-voice-server/src/main/java/com/epmet/GovVoiceApplication.java

@ -2,6 +2,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.scheduling.annotation.EnableAsync;
@ -15,6 +16,7 @@ import org.springframework.scheduling.annotation.EnableAsync;
@EnableDiscoveryClient
@EnableFeignClients
@EnableAsync
@ServletComponentScan
public class GovVoiceApplication {
public static void main(String[] args) {
SpringApplication.run(GovVoiceApplication.class, args);

2
epmet-module/oper-access/oper-access-server/src/main/java/com/epmet/OperAccessApplication.java

@ -2,6 +2,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -14,6 +15,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class OperAccessApplication {
public static void main(String[] args) {
SpringApplication.run(OperAccessApplication.class, args);

2
epmet-module/oper-crm/oper-crm-server/src/main/java/com/epmet/OperCrmApplication.java

@ -10,6 +10,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -22,6 +23,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class OperCrmApplication {
public static void main(String[] args) {

2
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/OperCustomizeApplication.java

@ -10,6 +10,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -22,6 +23,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class OperCustomizeApplication {
public static void main(String[] args) {

2
epmet-module/resi-group/resi-group-server/src/main/java/com/epmet/ResiGroupApplication.java

@ -10,6 +10,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -22,6 +23,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class ResiGroupApplication {
public static void main(String[] args) {

2
epmet-module/resi-guide/resi-guide-server/src/main/java/com/epmet/ResiGuideApplication.java

@ -10,6 +10,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -22,6 +23,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class ResiGuideApplication {
public static void main(String[] args) {

2
epmet-module/resi-hall/resi-hall-server/src/main/java/com/epmet/ResiHallApplication.java

@ -2,6 +2,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -14,6 +15,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class ResiHallApplication {
public static void main(String[] args) {

2
epmet-module/resi-home/resi-home-server/src/main/java/com/epmet/ResiHomeApplication.java

@ -2,6 +2,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -14,6 +15,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class ResiHomeApplication {
public static void main(String[] args) {

2
epmet-module/resi-mine/resi-mine-server/src/main/java/com/epmet/ResiMineApplication.java

@ -10,6 +10,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -22,6 +23,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class ResiMineApplication {
public static void main(String[] args) {

2
epmet-module/resi-partymember/resi-partymember-server/src/main/java/com/epmet/ResiPartyMemberApplication.java

@ -10,6 +10,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -22,6 +23,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class ResiPartyMemberApplication {
public static void main(String[] args) {

2
epmet-module/resi-voice/resi-voice-server/src/main/java/com/epmet/ResiVoiceApplication.java

@ -2,6 +2,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -13,6 +14,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class ResiVoiceApplication {
public static void main(String[] args) {
SpringApplication.run(ResiVoiceApplication.class, args);

2
epmet-openapi/epmet-openapi-scan/src/main/java/com/epmet/openapi/scan/ScanApplication.java

@ -10,6 +10,7 @@ package com.epmet.openapi.scan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.annotation.ComponentScan;
/**
@ -21,6 +22,7 @@ import org.springframework.context.annotation.ComponentScan;
@SpringBootApplication
@ComponentScan(basePackages = "com.epmet")
@ServletComponentScan
public class ScanApplication {
public static void main(String[] args) {

2
epmet-user/epmet-user-server/src/main/java/com/epmet/UserApplication.java

@ -10,6 +10,7 @@ package com.epmet;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
@ -23,6 +24,7 @@ import org.springframework.cloud.openfeign.EnableFeignClients;
@SpringBootApplication
@EnableDiscoveryClient
@EnableFeignClients
@ServletComponentScan
public class UserApplication {
public static void main(String[] args) {

Loading…
Cancel
Save