mirror of
https://gitee.com/dromara/RuoYi-Cloud-Plus.git
synced 2025-09-28 22:51:54 +00:00
fix 修复 monitor 监控无法展示数据问题
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dromara</groupId>
|
<groupId>org.dromara</groupId>
|
||||||
<artifactId>ruoyi-common-json</artifactId>
|
<artifactId>ruoyi-common-core</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringBoot Web容器 -->
|
<!-- SpringBoot Web容器 -->
|
||||||
|
@@ -35,15 +35,21 @@
|
|||||||
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- SpringCloud Alibaba Sentinel -->
|
<!-- SpringBoot Web容器 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>com.alibaba.cloud</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
|
<artifactId>spring-boot-starter-web</artifactId>
|
||||||
|
<exclusions>
|
||||||
|
<exclusion>
|
||||||
|
<artifactId>spring-boot-starter-tomcat</artifactId>
|
||||||
|
<groupId>org.springframework.boot</groupId>
|
||||||
|
</exclusion>
|
||||||
|
</exclusions>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<!-- web 容器使用 undertow 性能更强 -->
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.dromara</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>ruoyi-common-web</artifactId>
|
<artifactId>spring-boot-starter-undertow</artifactId>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
|
||||||
<!-- Spring Security -->
|
<!-- Spring Security -->
|
||||||
|
@@ -1,6 +1,5 @@
|
|||||||
package org.dromara.modules.monitor;
|
package org.dromara.modules.monitor;
|
||||||
|
|
||||||
import de.codecentric.boot.admin.server.config.EnableAdminServer;
|
|
||||||
import org.springframework.boot.SpringApplication;
|
import org.springframework.boot.SpringApplication;
|
||||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||||
|
|
||||||
@@ -9,7 +8,6 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author ruoyi
|
||||||
*/
|
*/
|
||||||
@EnableAdminServer
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class RuoYiMonitorApplication {
|
public class RuoYiMonitorApplication {
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
@@ -0,0 +1,31 @@
|
|||||||
|
package org.dromara.modules.monitor.config;
|
||||||
|
|
||||||
|
import de.codecentric.boot.admin.server.config.EnableAdminServer;
|
||||||
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||||
|
import org.springframework.boot.autoconfigure.task.TaskExecutionAutoConfiguration;
|
||||||
|
import org.springframework.boot.task.TaskExecutorBuilder;
|
||||||
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
|
import org.springframework.context.annotation.Lazy;
|
||||||
|
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||||
|
|
||||||
|
import java.util.concurrent.Executor;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* springboot-admin server配置类
|
||||||
|
*
|
||||||
|
* @author Lion Li
|
||||||
|
*/
|
||||||
|
@Configuration
|
||||||
|
@EnableAdminServer
|
||||||
|
public class AdminServerConfig {
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
@Bean(name = TaskExecutionAutoConfiguration.APPLICATION_TASK_EXECUTOR_BEAN_NAME)
|
||||||
|
@ConditionalOnMissingBean(Executor.class)
|
||||||
|
public ThreadPoolTaskExecutor applicationTaskExecutor(TaskExecutorBuilder builder) {
|
||||||
|
return builder.build();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
@@ -2,18 +2,21 @@ package org.dromara.modules.monitor.config;
|
|||||||
|
|
||||||
import de.codecentric.boot.admin.server.config.AdminServerProperties;
|
import de.codecentric.boot.admin.server.config.AdminServerProperties;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
|
import org.springframework.context.annotation.Configuration;
|
||||||
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
|
||||||
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
import org.springframework.security.config.annotation.web.configuration.EnableWebSecurity;
|
||||||
import org.springframework.security.web.SecurityFilterChain;
|
import org.springframework.security.web.SecurityFilterChain;
|
||||||
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
|
import org.springframework.security.web.authentication.SavedRequestAwareAuthenticationSuccessHandler;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 监控权限配置
|
* admin 监控 安全配置
|
||||||
*
|
*
|
||||||
* @author ruoyi
|
* @author Lion Li
|
||||||
*/
|
*/
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
|
@Configuration
|
||||||
public class WebSecurityConfigurer {
|
public class WebSecurityConfigurer {
|
||||||
|
|
||||||
private final String adminContextPath;
|
private final String adminContextPath;
|
||||||
|
|
||||||
public WebSecurityConfigurer(AdminServerProperties adminServerProperties) {
|
public WebSecurityConfigurer(AdminServerProperties adminServerProperties) {
|
||||||
@@ -27,22 +30,23 @@ public class WebSecurityConfigurer {
|
|||||||
successHandler.setDefaultTargetUrl(adminContextPath + "/");
|
successHandler.setDefaultTargetUrl(adminContextPath + "/");
|
||||||
|
|
||||||
return httpSecurity
|
return httpSecurity
|
||||||
.headers().frameOptions().disable()
|
.headers().frameOptions().disable()
|
||||||
.and().authorizeHttpRequests()
|
.and().authorizeHttpRequests()
|
||||||
.requestMatchers(adminContextPath + "/assets/**"
|
.requestMatchers(adminContextPath + "/assets/**"
|
||||||
, adminContextPath + "/login"
|
, adminContextPath + "/login"
|
||||||
, adminContextPath + "/actuator/**"
|
, "/actuator"
|
||||||
, adminContextPath + "/instances/**"
|
, "/actuator/**"
|
||||||
).permitAll()
|
).permitAll()
|
||||||
.anyRequest().authenticated()
|
.anyRequest().authenticated()
|
||||||
.and()
|
.and()
|
||||||
.formLogin().loginPage(adminContextPath + "/login")
|
.formLogin().loginPage(adminContextPath + "/login")
|
||||||
.successHandler(successHandler).and()
|
.successHandler(successHandler).and()
|
||||||
.logout().logoutUrl(adminContextPath + "/logout")
|
.logout().logoutUrl(adminContextPath + "/logout")
|
||||||
.and()
|
.and()
|
||||||
.httpBasic().and()
|
.httpBasic().and()
|
||||||
.csrf()
|
.csrf()
|
||||||
.disable()
|
.disable()
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -30,7 +30,7 @@
|
|||||||
<nacos.version>2.2.1</nacos.version>
|
<nacos.version>2.2.1</nacos.version>
|
||||||
<!-- 需要与 Nacos 内置 Boot 版本保持一致 -->
|
<!-- 需要与 Nacos 内置 Boot 版本保持一致 -->
|
||||||
<spring-boot.version>2.7.12</spring-boot.version>
|
<spring-boot.version>2.7.12</spring-boot.version>
|
||||||
<spring-boot-admin.version>2.6.11</spring-boot-admin.version>
|
<spring-boot-admin.version>2.7.10</spring-boot-admin.version>
|
||||||
<nacos.lib.path>${project.basedir}/src/main/resources/lib</nacos.lib.path>
|
<nacos.lib.path>${project.basedir}/src/main/resources/lib</nacos.lib.path>
|
||||||
</properties>
|
</properties>
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user