From 011d8817efc29748356176294474b8e4cd87a390 Mon Sep 17 00:00:00 2001 From: meng <154040976@qq.com> Date: Tue, 30 Apr 2019 23:46:39 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96=20spring=20boot=20admin=20?= =?UTF-8?q?=E7=9B=91=E6=8E=A7=E5=8D=87=E7=BA=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- len-admin/pom.xml | 23 ++++++++++--------- .../com/len/SpringBootAdminApplication.java | 2 +- len-admin/src/main/resource/application.yml | 9 -------- len-web/pom.xml | 14 +++++++++++ .../src/main/java/com/len/Application.java | 2 ++ .../main/java/com/len/config/ShiroConfig.java | 2 ++ .../main/resources/application-mysql-dev.yml | 17 ++++++++++++-- pom.xml | 6 +++++ 8 files changed, 52 insertions(+), 23 deletions(-) diff --git a/len-admin/pom.xml b/len-admin/pom.xml index 91bbf6e..1dedfca 100644 --- a/len-admin/pom.xml +++ b/len-admin/pom.xml @@ -5,7 +5,7 @@ org.springframework.boot spring-boot-starter-parent - 1.5.9.RELEASE + 2.0.1.RELEASE 4.0.0 @@ -18,17 +18,7 @@ - - de.codecentric - spring-boot-admin-server - 1.5.0 - - - de.codecentric - spring-boot-admin-server-ui - 1.5.0 - org.springframework.boot spring-boot-starter-test @@ -49,6 +39,17 @@ com.fasterxml.jackson.module jackson-module-parameter-names + + + de.codecentric + spring-boot-admin-starter-server + 2.0.1 + + + + org.springframework.boot + spring-boot-starter-web + diff --git a/len-admin/src/main/java/com/len/SpringBootAdminApplication.java b/len-admin/src/main/java/com/len/SpringBootAdminApplication.java index 26a6a34..820375a 100644 --- a/len-admin/src/main/java/com/len/SpringBootAdminApplication.java +++ b/len-admin/src/main/java/com/len/SpringBootAdminApplication.java @@ -1,6 +1,6 @@ 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.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; diff --git a/len-admin/src/main/resource/application.yml b/len-admin/src/main/resource/application.yml index e9e9477..1d02b68 100644 --- a/len-admin/src/main/resource/application.yml +++ b/len-admin/src/main/resource/application.yml @@ -2,12 +2,3 @@ server.port: 8082 spring: application: name: len-admin - jackson: - serialization: - indent_output: true - boot: - admin: - url: http://localhost:${server.port} -endpoints: - health: - sensitive: false \ No newline at end of file diff --git a/len-web/pom.xml b/len-web/pom.xml index e5f5f51..84f7d25 100644 --- a/len-web/pom.xml +++ b/len-web/pom.xml @@ -13,6 +13,7 @@ http://maven.apache.org jar + @@ -26,6 +27,19 @@ spring-boot-starter-web + + + + de.codecentric + spring-boot-admin-starter-client + 2.0.1 + + + org.springframework.cloud + spring-cloud-starter-netflix-eureka-client + 2.0.1.RELEASE + + com.len len-core diff --git a/len-web/src/main/java/com/len/Application.java b/len-web/src/main/java/com/len/Application.java index 83614f6..43b9955 100644 --- a/len-web/src/main/java/com/len/Application.java +++ b/len-web/src/main/java/com/len/Application.java @@ -3,6 +3,7 @@ package com.len; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.EnableAutoConfiguration; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.cloud.client.discovery.EnableDiscoveryClient; import org.springframework.context.ApplicationContext; import org.springframework.context.annotation.ComponentScan; import org.springframework.transaction.annotation.EnableTransactionManagement; @@ -20,6 +21,7 @@ import tk.mybatis.spring.annotation.MapperScan; @EnableTransactionManagement @ComponentScan({"com.len", "org.activiti"}) @MapperScan(basePackages = {"com.len.mapper"}) +@EnableDiscoveryClient @EnableAutoConfiguration(exclude = { org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration.class }) diff --git a/len-web/src/main/java/com/len/config/ShiroConfig.java b/len-web/src/main/java/com/len/config/ShiroConfig.java index c0cabe1..b34d33a 100644 --- a/len-web/src/main/java/com/len/config/ShiroConfig.java +++ b/len-web/src/main/java/com/len/config/ShiroConfig.java @@ -138,6 +138,8 @@ public class ShiroConfig { filterMap.put("/login", "verCode,anon"); filterMap.put("/blogLogin", "verCode,anon"); filterMap.put("/getCode", "anon"); + filterMap.put("/actuator/**", "anon"); + filterMap.put("/eureka/**", "anon"); filterMap.put("/img/**", "anon"); filterMap.put("/logout", "logout"); filterMap.put("/plugin/**", "anon"); diff --git a/len-web/src/main/resources/application-mysql-dev.yml b/len-web/src/main/resources/application-mysql-dev.yml index eaf1ba4..6803a39 100644 --- a/len-web/src/main/resources/application-mysql-dev.yml +++ b/len-web/src/main/resources/application-mysql-dev.yml @@ -30,8 +30,21 @@ spring: boot: admin: 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: host: 127.0.0.1 port: 6379 diff --git a/pom.xml b/pom.xml index f89d6b8..d2c855b 100644 --- a/pom.xml +++ b/pom.xml @@ -25,6 +25,7 @@ len-web len-activiti len-blog + len-admin @@ -359,6 +360,11 @@ len-blog 1.0-SNAPSHOT + + com.len + len-admin + 1.0-SNAPSHOT +