Skip to content

Commit c0b6593

Browse files
author
geekidea
committed
集成Spring Boot Admin
Former-commit-id: a97502b28520d5072f6ba484d4610b2bd5a1e27a
1 parent 4b797d9 commit c0b6593

File tree

5 files changed

+40
-12
lines changed

5 files changed

+40
-12
lines changed

pom.xml

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@
6363
<lombok.version>1.18.8</lombok.version>
6464
<commons-pool2.version>2.6.2</commons-pool2.version>
6565
<jwt.version>0.9.1</jwt.version>
66+
<spring-boot-admin.version>2.1.6</spring-boot-admin.version>
6667

6768
<maven-compiler-source.version>1.8</maven-compiler-source.version>
6869
<maven-compiler-target.version>1.8</maven-compiler-target.version>
@@ -261,6 +262,19 @@
261262
<version>4.5.10</version>
262263
</dependency>
263264

265+
<!-- spring boot admin start -->
266+
<dependency>
267+
<groupId>de.codecentric</groupId>
268+
<artifactId>spring-boot-admin-starter-server</artifactId>
269+
<version>${spring-boot-admin.version}</version>
270+
</dependency>
271+
<dependency>
272+
<groupId>de.codecentric</groupId>
273+
<artifactId>spring-boot-admin-starter-client</artifactId>
274+
<version>${spring-boot-admin.version}</version>
275+
</dependency>
276+
<!-- spring boot admin end -->
277+
264278
</dependencies>
265279

266280
<build>

src/main/java/io/geekidea/springbootplus/SpringBootPlusApplication.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package io.geekidea.springbootplus;
1818

19+
import de.codecentric.boot.admin.server.config.EnableAdminServer;
1920
import io.geekidea.springbootplus.util.PrintApplicationInfo;
2021
import lombok.extern.slf4j.Slf4j;
2122
import org.mybatis.spring.annotation.MapperScan;
@@ -38,6 +39,7 @@
3839
@EnableScheduling
3940
@EnableTransactionManagement
4041
@EnableConfigurationProperties
42+
@EnableAdminServer
4143
@SpringBootApplication
4244
@MapperScan({"io.geekidea.springbootplus.**.mapper"})
4345
public class SpringBootPlusApplication {

src/main/java/io/geekidea/springbootplus/common/web/controller/IndexController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434
@Slf4j
3535
public class IndexController {
3636

37-
@RequestMapping("/")
37+
@RequestMapping("/index")
3838
public ApiResult<String> index(){
3939
log.debug("index...");
4040
return ApiResult.ok("Welcome to Spring Boot Plus Project...");

src/main/resources/config/application.yml

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -139,12 +139,6 @@ mybatis-plus:
139139
logic-not-delete-value: 1
140140
mapper-locations: classpath*:mapper/**/*Mapper.xml
141141

142-
# 开启和暴露所有端点
143-
management:
144-
endpoints:
145-
web:
146-
exposure:
147-
include: '*'
148142

149143
swagger:
150144
base:
@@ -160,15 +154,31 @@ swagger:
160154

161155

162156
info:
157+
project-groupId: '@project.groupId@'
163158
project-artifactId: '@project.artifactId@'
159+
project-name: '@project.name@'
160+
project-finalName: '@project.build.finalName@'
164161
project-author: ${swagger.contact.name}
165162
project-description: '@project.description@'
166-
project-finalName: '@project.build.finalName@'
167-
project-groupId: '@project.groupId@'
168-
project-name: '@project.name@'
169163
project-sourceEncoding: '@project.build.sourceEncoding@'
170-
project-spring-boot-version: '@project-parent.version@'
164+
project-spring-boot-version: '@spring-boot.version@'
165+
project-mybatis-plus-version: '@mybatis-plus-boot-starter.version@'
171166
project-version: '@project.version@'
172167

168+
---
169+
# spring boot admin
170+
spring:
171+
boot:
172+
admin:
173+
client:
174+
url: 'http://localhost:8888'
173175

174-
176+
# 开启和暴露所有端点
177+
management:
178+
endpoints:
179+
web:
180+
exposure:
181+
include: "*"
182+
endpoint:
183+
health:
184+
show-details: ALWAYS

src/main/resources/config/banner.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ ${AnsiColor.BLUE}
1010

1111
:: Spring Boot :: (v${spring-boot.version})
1212
:: Spring Boot Plus :: (v${project.version})
13+
:: spring-boot-plus :: https://springboot.plus
14+

0 commit comments

Comments
 (0)