diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/common/aspect/AutoLogAspect.java b/jeecg-boot-base-core/src/main/java/org/jeecg/common/aspect/AutoLogAspect.java index 71f97672c..ba47149cb 100644 --- a/jeecg-boot-base-core/src/main/java/org/jeecg/common/aspect/AutoLogAspect.java +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/common/aspect/AutoLogAspect.java @@ -21,6 +21,7 @@ import org.jeecg.common.util.IpUtils; import org.jeecg.common.util.SpringContextUtils; import org.jeecg.common.util.oConvertUtils; import org.springframework.core.LocalVariableTableParameterNameDiscoverer; +import org.springframework.core.StandardReflectionParameterNameDiscoverer; import org.springframework.stereotype.Component; import org.springframework.validation.BindingResult; import org.springframework.web.multipart.MultipartFile; @@ -169,7 +170,7 @@ public class AutoLogAspect { // 请求的方法参数值 Object[] args = joinPoint.getArgs(); // 请求的方法参数名称 - LocalVariableTableParameterNameDiscoverer u = new LocalVariableTableParameterNameDiscoverer(); + StandardReflectionParameterNameDiscoverer u=new StandardReflectionParameterNameDiscoverer(); String[] paramNames = u.getParameterNames(method); if (args != null && paramNames != null) { for (int i = 0; i < args.length; i++) { diff --git a/jeecg-boot-base-core/src/main/java/org/jeecg/config/DruidWallConfigRegister.java b/jeecg-boot-base-core/src/main/java/org/jeecg/config/DruidWallConfigRegister.java new file mode 100644 index 000000000..049d42105 --- /dev/null +++ b/jeecg-boot-base-core/src/main/java/org/jeecg/config/DruidWallConfigRegister.java @@ -0,0 +1,47 @@ +package org.jeecg.config; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.SpringApplicationRunListener; +import org.springframework.context.ConfigurableApplicationContext; +import org.springframework.core.env.ConfigurableEnvironment; +import org.springframework.core.env.MapPropertySource; +import org.springframework.core.env.MutablePropertySources; +import org.springframework.core.env.PropertySource; + +import java.util.HashMap; +import java.util.Map; + +/** + * @author eightmonth@qq.com + * @date 2024/4/8 11:37 + */ +public class DruidWallConfigRegister implements SpringApplicationRunListener { + + public SpringApplication application; + + private String[] args; + + + /** + * 必备,否则启动报错 + * @param application + * @param args + */ + public DruidWallConfigRegister(SpringApplication application, String[] args) { + this.application = application; + this.args = args; + } + + @Override + public void contextLoaded(ConfigurableApplicationContext context) { + ConfigurableEnvironment env = context.getEnvironment(); + Map props = new HashMap<>(); + props.put("spring.datasource.dynamic.druid.wall.selectWhereAlwayTrueCheck", false); + + MutablePropertySources propertySources = env.getPropertySources(); + + PropertySource> propertySource = new MapPropertySource("jeecg-datasource-config", props); + + propertySources.addLast(propertySource); + } +} \ No newline at end of file diff --git a/jeecg-boot-base-core/src/main/resources/META-INF/spring.factories b/jeecg-boot-base-core/src/main/resources/META-INF/spring.factories new file mode 100644 index 000000000..8ba71de9f --- /dev/null +++ b/jeecg-boot-base-core/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.SpringApplicationRunListener=\ +org.jeecg.config.DruidWallConfigRegister \ No newline at end of file diff --git a/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml b/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml index b14f3f229..d9d9187d7 100644 --- a/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml +++ b/jeecg-module-system/jeecg-system-start/src/main/resources/application-dev.yml @@ -22,7 +22,7 @@ management: endpoints: web: exposure: - include: metrics,httptrace + include: metrics,httpexchanges spring: # flyway配置 @@ -156,7 +156,7 @@ spring: poolPreparedStatements: true maxPoolPreparedStatementPerConnectionSize: 20 # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 - filters: stat,wall,slf4j + filters: stat,slf4j # 打开mergeSql功能;慢SQL记录 stat: merge-sql: true diff --git a/jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml b/jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml index 809a7c3f2..602f8e342 100644 --- a/jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml +++ b/jeecg-module-system/jeecg-system-start/src/main/resources/application-prod.yml @@ -22,7 +22,7 @@ management: endpoints: web: exposure: - include: metrics,httptrace + include: metrics,httpexchanges spring: # flyway配置 @@ -156,7 +156,7 @@ spring: poolPreparedStatements: true maxPoolPreparedStatementPerConnectionSize: 20 # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 - filters: stat,wall,slf4j + filters: stat,slf4j # 打开mergeSql功能;慢SQL记录 stat: merge-sql: true diff --git a/jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml b/jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml index da33471c9..dba259d5f 100644 --- a/jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml +++ b/jeecg-module-system/jeecg-system-start/src/main/resources/application-test.yml @@ -22,7 +22,7 @@ management: endpoints: web: exposure: - include: metrics,httptrace + include: metrics,httpexchanges spring: # flyway配置 @@ -156,7 +156,7 @@ spring: poolPreparedStatements: true maxPoolPreparedStatementPerConnectionSize: 20 # 配置监控统计拦截的filters,去掉后监控界面sql无法统计,'wall'用于防火墙 - filters: stat,wall,slf4j + filters: stat,slf4j # 打开mergeSql功能;慢SQL记录 stat: merge-sql: true diff --git a/jeecg-server-cloud/jeecg-visual/jeecg-cloud-monitor/src/main/resources/application.yml b/jeecg-server-cloud/jeecg-visual/jeecg-cloud-monitor/src/main/resources/application.yml index dfd31b8f6..f137704a7 100644 --- a/jeecg-server-cloud/jeecg-visual/jeecg-cloud-monitor/src/main/resources/application.yml +++ b/jeecg-server-cloud/jeecg-visual/jeecg-cloud-monitor/src/main/resources/application.yml @@ -20,13 +20,14 @@ spring: nacos: discovery: server-addr: @config.server-addr@ + namespace: @config.namespace@ metadata: user.name: ${spring.security.user.name} user.password: ${spring.security.user.password} # 服务端点检查 management: - trace: - http: + httpexchanges: + recording: enabled: true endpoints: web: