优化 spring boot admin 监控升级

This commit is contained in:
meng 2019-04-30 23:46:39 +08:00
parent 541d033492
commit 011d8817ef
8 changed files with 52 additions and 23 deletions

View File

@ -5,7 +5,7 @@
<parent> <parent>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId> <artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.9.RELEASE</version> <version>2.0.1.RELEASE</version>
<relativePath /> <relativePath />
</parent> </parent>
<modelVersion>4.0.0</modelVersion> <modelVersion>4.0.0</modelVersion>
@ -18,17 +18,7 @@
<dependencies> <dependencies>
<!-- https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-server --> <!-- https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-server -->
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>1.5.0</version>
</dependency>
<!-- https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-server-ui --> <!-- https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-server-ui -->
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>1.5.0</version>
</dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId> <artifactId>spring-boot-starter-test</artifactId>
@ -49,6 +39,17 @@
<groupId>com.fasterxml.jackson.module</groupId> <groupId>com.fasterxml.jackson.module</groupId>
<artifactId>jackson-module-parameter-names</artifactId> <artifactId>jackson-module-parameter-names</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-starter-server -->
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
</dependencies> </dependencies>

View File

@ -1,6 +1,6 @@
package com.len; package com.len;
import de.codecentric.boot.admin.config.EnableAdminServer; import de.codecentric.boot.admin.server.config.EnableAdminServer;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;

View File

@ -2,12 +2,3 @@ server.port: 8082
spring: spring:
application: application:
name: len-admin name: len-admin
jackson:
serialization:
indent_output: true
boot:
admin:
url: http://localhost:${server.port}
endpoints:
health:
sensitive: false

View File

@ -13,6 +13,7 @@
<url>http://maven.apache.org</url> <url>http://maven.apache.org</url>
<packaging>jar</packaging> <packaging>jar</packaging>
<dependencies> <dependencies>
<!--生成代码插件--> <!--生成代码插件-->
@ -26,6 +27,19 @@
<artifactId>spring-boot-starter-web</artifactId> <artifactId>spring-boot-starter-web</artifactId>
</dependency> </dependency>
<!-- https://mvnrepository.com/artifact/de.codecentric/spring-boot-admin-starter-client -->
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
<version>2.0.1.RELEASE</version>
</dependency>
<dependency> <dependency>
<groupId>com.len</groupId> <groupId>com.len</groupId>
<artifactId>len-core</artifactId> <artifactId>len-core</artifactId>

View File

@ -3,6 +3,7 @@ package com.len;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.ComponentScan;
import org.springframework.transaction.annotation.EnableTransactionManagement; import org.springframework.transaction.annotation.EnableTransactionManagement;
@ -20,6 +21,7 @@ import tk.mybatis.spring.annotation.MapperScan;
@EnableTransactionManagement @EnableTransactionManagement
@ComponentScan({"com.len", "org.activiti"}) @ComponentScan({"com.len", "org.activiti"})
@MapperScan(basePackages = {"com.len.mapper"}) @MapperScan(basePackages = {"com.len.mapper"})
@EnableDiscoveryClient
@EnableAutoConfiguration(exclude = { @EnableAutoConfiguration(exclude = {
org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class
}) })

View File

@ -138,6 +138,8 @@ public class ShiroConfig {
filterMap.put("/login", "verCode,anon"); filterMap.put("/login", "verCode,anon");
filterMap.put("/blogLogin", "verCode,anon"); filterMap.put("/blogLogin", "verCode,anon");
filterMap.put("/getCode", "anon"); filterMap.put("/getCode", "anon");
filterMap.put("/actuator/**", "anon");
filterMap.put("/eureka/**", "anon");
filterMap.put("/img/**", "anon"); filterMap.put("/img/**", "anon");
filterMap.put("/logout", "logout"); filterMap.put("/logout", "logout");
filterMap.put("/plugin/**", "anon"); filterMap.put("/plugin/**", "anon");

View File

@ -30,8 +30,21 @@ spring:
boot: boot:
admin: admin:
client: client:
prefer-ip: true url: http://localhost:8082
url: http://localhost:8082
management:
endpoints:
web:
exposure:
include: "*"
endpoint:
health:
show-details: ALWAYS
eureka:
client:
fetch-registry: false
register-with-eureka: false
redis: redis:
host: 127.0.0.1 host: 127.0.0.1
port: 6379 port: 6379

View File

@ -25,6 +25,7 @@
<module>len-web</module> <module>len-web</module>
<module>len-activiti</module> <module>len-activiti</module>
<module>len-blog</module> <module>len-blog</module>
<module>len-admin</module>
</modules> </modules>
<dependencies> <dependencies>
@ -359,6 +360,11 @@
<artifactId>len-blog</artifactId> <artifactId>len-blog</artifactId>
<version>1.0-SNAPSHOT</version> <version>1.0-SNAPSHOT</version>
</dependency> </dependency>
<dependency>
<groupId>com.len</groupId>
<artifactId>len-admin</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
</dependencies> </dependencies>
</dependencyManagement> </dependencyManagement>