最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

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

 更新時(shí)間:2018年02月07日 11:06:31   作者:向上攀爬的笨鳥  
這篇文章主要介紹了spring boot 添加admin監(jiān)控的相關(guān)知識(shí),非常不錯(cuò),具有參考借鑒價(jià)值,需要的朋友可以參考下

一、Spring Boot  Admin簡(jiǎn)介

spring boot admin github開(kāi)源地址:https://github.com/codecentric/spring-boot-admin

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

二、項(xiàng)目使用:

1、搭建一個(gè)maven web項(xiàng)目

2、pom依賴配置

<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  (加上該項(xiàng)能監(jiān)控服務(wù)端自身的運(yùn)行狀態(tài),其他項(xiàng)目只需要引入client就可以引入監(jiān)控)

安全:spring-boot-starter-security

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

3、application.yml

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ù)端地址(其他項(xiàng)目會(huì)通過(guò)這個(gè)url主動(dòng)的注冊(cè)到admin監(jiān)控中)
            info配置app的基本信息

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

4、Application.java

@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 添加上該注解啟動(dòng)監(jiān)控

5、SecurityConfig

@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配置一個(gè)基本的安全策略

6、監(jiān)管管理

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

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

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

總結(jié)

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

相關(guān)文章

  • Idea+maven搭建SSH(struts2+hibernate5+spring5)環(huán)境的方法步驟

    Idea+maven搭建SSH(struts2+hibernate5+spring5)環(huán)境的方法步驟

    這篇文章主要介紹了Idea+maven搭建SSH(struts2+hibernate5+spring5)環(huán)境的方法步驟,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-06-06
  • Java實(shí)現(xiàn)圖片與二進(jìn)制的互相轉(zhuǎn)換

    Java實(shí)現(xiàn)圖片與二進(jìn)制的互相轉(zhuǎn)換

    這篇文章主要為大家詳細(xì)介紹了Java實(shí)現(xiàn)圖片與二進(jìn)制的互相轉(zhuǎn)換,將圖片轉(zhuǎn)二進(jìn)制再將二進(jìn)制轉(zhuǎn)成圖片,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2018-03-03
  • Spring?Boot整合Bootstrap的超詳細(xì)步驟

    Spring?Boot整合Bootstrap的超詳細(xì)步驟

    之前做前端開(kāi)發(fā),在使用bootstrap的時(shí)候都是去官網(wǎng)下載,然后放到項(xiàng)目中,在頁(yè)面引用,下面這篇文章主要給大家介紹了關(guān)于Spring?Boot整合Bootstrap的超詳細(xì)步驟,需要的朋友可以參考下
    2023-05-05
  • SpringBoot一個(gè)非常蛋疼的無(wú)法啟動(dòng)的問(wèn)題解決

    SpringBoot一個(gè)非常蛋疼的無(wú)法啟動(dòng)的問(wèn)題解決

    這篇文章主要介紹了SpringBoot一個(gè)非常蛋疼的無(wú)法啟動(dòng)的問(wèn)題解決,文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2020-11-11
  • Spring Cloud下基于OAUTH2認(rèn)證授權(quán)的實(shí)現(xiàn)示例

    Spring Cloud下基于OAUTH2認(rèn)證授權(quán)的實(shí)現(xiàn)示例

    這篇文章主要介紹了Spring Cloud下基于OAUTH2認(rèn)證授權(quán)的實(shí)現(xiàn)示例,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2018-03-03
  • Spring.Net控制反轉(zhuǎn)IoC入門使用

    Spring.Net控制反轉(zhuǎn)IoC入門使用

    這篇文章主要為大家詳細(xì)介紹了Spring.Net控制反轉(zhuǎn)IoC入門使用的相關(guān)資料,具有一定的參考價(jià)值,感興趣的小伙伴們可以參考一下
    2017-06-06
  • maven 刪除下載失敗的包的方法

    maven 刪除下載失敗的包的方法

    本文介紹了當(dāng)Maven包報(bào)紅時(shí),使用刪除相關(guān)文件的方法來(lái)解決該問(wèn)題,具有一定的參考價(jià)值,感興趣的可以了解一下
    2023-09-09
  • 詳解在Spring Boot中使用JPA

    詳解在Spring Boot中使用JPA

    本篇文章主要介紹了詳解在Spring Boot中使用JPA,小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,也給大家做個(gè)參考。一起跟隨小編過(guò)來(lái)看看吧
    2017-05-05
  • 詳解Mybatis注解寫法(附10余個(gè)常用例子)

    詳解Mybatis注解寫法(附10余個(gè)常用例子)

    這篇文章主要介紹了詳解Mybatis注解寫法(附10余個(gè)常用例子),文中通過(guò)示例代碼介紹的非常詳細(xì),對(duì)大家的學(xué)習(xí)或者工作具有一定的參考學(xué)習(xí)價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)學(xué)習(xí)吧
    2019-10-10
  • Mybatis操作數(shù)據(jù)時(shí)出現(xiàn):java.sql.SQLSyntaxErrorException:?Unknown?column?'XXX'?in?'field?list'的問(wèn)題解決

    Mybatis操作數(shù)據(jù)時(shí)出現(xiàn):java.sql.SQLSyntaxErrorException:?Unknown?c

    這篇文章主要介紹了Mybatis操作數(shù)據(jù)時(shí)出現(xiàn):java.sql.SQLSyntaxErrorException:?Unknown?column?'XXX'?in?'field?list',需要的朋友可以參考下
    2023-04-04

最新評(píng)論

吉隆县| 华坪县| 奉新县| 鱼台县| 平泉县| 分宜县| 石台县| 正镶白旗| 滁州市| 碌曲县| 南乐县| 平顺县| 江都市| 文昌市| 黄冈市| 建阳市| 汉阴县| 子洲县| 津南区| 兴仁县| 颍上县| 崇礼县| 石河子市| 延安市| 民权县| 长宁区| 瑞昌市| 南开区| 墨江| 阿鲁科尔沁旗| 湘阴县| 盐亭县| 湘乡市| 南丹县| 永修县| 三穗县| 乌鲁木齐县| 花莲市| 香港 | 崇礼县| 镇沅|