国产片侵犯亲女视频播放_亚洲精品二区_在线免费国产视频_欧美精品一区二区三区在线_少妇久久久_在线观看av不卡

服務(wù)器之家:專注于服務(wù)器技術(shù)及軟件下載分享
分類導(dǎo)航

PHP教程|ASP.NET教程|Java教程|ASP教程|編程技術(shù)|正則表達(dá)式|C/C++|IOS|C#|Swift|Android|VB|R語言|JavaScript|易語言|vb.net|

服務(wù)器之家 - 編程語言 - Java教程 - spring boot 添加admin監(jiān)控的方法

spring boot 添加admin監(jiān)控的方法

2021-04-02 11:18向上攀爬的笨鳥 Java教程

這篇文章主要介紹了spring boot 添加admin監(jiān)控的相關(guān)知識,非常不錯,具有參考借鑒價值,需要的朋友可以參考下

一、Spring Boot  Admin簡介

spring boot admin github開源地址:https://github.com/codecentric/spring-boot-admin

它主要的作用是在Spring Boot Actuator的基礎(chǔ)上提供簡潔的WEB UI展示。

二、項目使用:

1、搭建一個maven web項目

2、pom依賴配置

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
  <groupId>org.springframework.boot</groupId>
  <artifactId>spring-boot-starter-security</artifactId>
</dependency>
<dependency>
  <groupId>de.codecentric</groupId>
  <artifactId>spring-boot-admin-starter-client</artifactId>
</dependency>
<dependency>
  <groupId>de.codecentric</groupId>
  <artifactId>spring-boot-admin-server</artifactId>
</dependency>
<dependency>
  <groupId>de.codecentric</groupId>
  <artifactId>spring-boot-admin-server-ui</artifactId>
</dependency>
<dependency>
  <groupId>de.codecentric</groupId>
  <artifactId>spring-boot-admin-server-ui-login</artifactId>
</dependency>

在pom.xml中添加上以上配置

admin服務(wù)端:spring-boot-admin-server、spring-boot-admin-server-ui

admin客戶端:spring-boot-admin-starter-client  (加上該項能監(jiān)控服務(wù)端自身的運(yùn)行狀態(tài),其他項目只需要引入client就可以引入監(jiān)控)

安全:spring-boot-starter-security

登錄驗證:spring-boot-admin-server-ui-login (也可以自行添加簡單的登錄界面)

3、application.yml

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
info:
 app:
  name: imard
  version: v1.0.0
[html] view plain copy
logging:
 file: "d:/logs/imard/boot.log"
management:
 context-path: "/actuator"
spring:
 application:
  name: "@pom.artifactId@"
 boot:
  admin:
   url: http://www.test.com:8080
 profiles:
  active:
   - secure
---
spring:
 profiles: insecure
management:
 security:
  enabled: false
security:
 basic:
  enabled: false
---
spring:
 profiles: secure
 boot:
  admin:
   username: "${security.user.name}"
   password: "${security.user.password}"
   client:
    metadata:
     user.name: "${security.user.name}"
     user.password: "${security.user.password}"
 
security:
 user:
  name: user
  password: pass

其中:spring.boot.admin.url聲明admin服務(wù)端地址(其他項目會通過這個url主動的注冊到admin監(jiān)控中)
            info配置app的基本信息

            www.test.com  在本機(jī)hosts中做了映射

4、Application.java

?
1
2
3
4
5
6
7
8
9
10
11
12
13
@Configuration
@EnableAutoConfiguration
@EnableAdminServer
public class Application extends SpringBootServletInitializer {
  @Override
  protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
    return application.sources(Application.class);
  }
 
  public static void main(String[] args) {
    SpringApplication.run(Application.class, args);
  }
}

@EnableAdminServer 添加上該注解啟動監(jiān)控

5、SecurityConfig

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
@Profile("secure")
@Configuration
public class SecurityConfig extends WebSecurityConfigurerAdapter {
  @Override
  protected void configure(HttpSecurity http) throws Exception {
    http.formLogin().loginPage("/login.html").loginProcessingUrl("/login").permitAll();
    http.logout().logoutUrl("/logout");
    http.csrf().disable();
    http.authorizeRequests()
      .antMatchers("/login.html", "/**/*.css", "/img/**", "/third-party/**").permitAll();
    http.authorizeRequests().antMatchers("/api/**").permitAll().antMatchers("/**")
      .authenticated();
    // Enable so that the clients can authenticate via HTTP basic for registering
    http.httpBasic();
  }
}

使用Spring Security配置一個基本的安全策略

6、監(jiān)管管理

配置完1~5個步驟以后,使用application啟動監(jiān)控程序。

通過http://www.test.com:8080/login.html監(jiān)控登錄界面進(jìn)行安全驗證后,如下圖:

spring boot 添加admin監(jiān)控的方法

進(jìn)入details就可以看到具體的項目監(jiān)控信息(Details、Log、Metrics、Environment、Logging、JMX、Threads、Audit、Trace、Heapdump)

總結(jié)

以上所述是小編給大家介紹的spring boot 添加admin監(jiān)控的方法,希望對大家有所幫助,如果大家有任何疑問請給我留言,小編會及時回復(fù)大家的。在此也非常感謝大家對服務(wù)器之家網(wǎng)站的支持!

原文鏈接:http://blog.csdn.net/sjhuhuan/article/details/72901609

延伸 · 閱讀

精彩推薦
Weibo Article 1 Weibo Article 2 Weibo Article 3 Weibo Article 4 Weibo Article 5 Weibo Article 6 Weibo Article 7 Weibo Article 8 Weibo Article 9 Weibo Article 10 Weibo Article 11 Weibo Article 12 Weibo Article 13 Weibo Article 14 Weibo Article 15 Weibo Article 16 Weibo Article 17 Weibo Article 18 Weibo Article 19 Weibo Article 20 Weibo Article 21 Weibo Article 22 Weibo Article 23 Weibo Article 24 Weibo Article 25 Weibo Article 26 Weibo Article 27 Weibo Article 28 Weibo Article 29 Weibo Article 30 Weibo Article 31 Weibo Article 32 Weibo Article 33 Weibo Article 34 Weibo Article 35 Weibo Article 36 Weibo Article 37 Weibo Article 38 Weibo Article 39 Weibo Article 40
主站蜘蛛池模板: 国产亚洲精品一区二区 | 天天看夜夜爽 | 亚洲成人激情在线 | 国产v日产∨综合v精品视频 | 亚洲久久| 欧美成年黄网站色视频 | 欧美日韩国产影院 | 观看av| 日日夜夜狠狠干 | 久久精品亚洲精品 | 黄色精品一区二区 | 国产精品美女高潮无套久久 | 精精国产xxxx视频在线观看 | 免费欧美一级 | 伊人短视频 | 欧美一区二区免费在线 | 日韩视频在线一区 | av免费网| 日韩不卡一区二区三区 | 日日干夜夜操 | 久久久艹| 欧洲成人在线 | 中文字幕乱码亚洲精品一区 | 欧洲一区在线观看 | 黄色大片一级 | 在线色网站 | 久久99蜜桃综合影院免费观看 | 国产激情视频 | 亚洲国产精品视频 | 色就是色网站 | 亚洲一区国产视频 | 欧美日韩国产影院 | 成年人毛片在线观看 | 亚洲精品久久久久久久久久久久久 | 久久久久久国产免费 | 国产免费av在线 | 黄色片免费看 | 日韩成人在线一区 | 91视频免费网站 | 亚洲专区视频 | 久久精品一区二区三区四区 |