前往小程序,Get更优阅读体验!
立即前往
首页
学习
活动
专区
工具
TVP
发布
社区首页 >专栏 >spring-boot-admin 2.0小试牛刀

spring-boot-admin 2.0小试牛刀

作者头像
code4it
发布2018-09-17 16:45:26
4480
发布2018-09-17 16:45:26
举报
文章被收录于专栏:码匠的流水账

本文主要展示下spring-boot-admin 2.0版本的新特性

server实例

maven

代码语言:javascript
复制
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-server</artifactId>
            <version>2.0.0</version>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-webflux</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jolokia</groupId>
            <artifactId>jolokia-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>

配置

代码语言:javascript
复制
spring:
  application:
    name: spring-boot-admin-server
eureka:
  instance:
    preferIpAddress: true
    leaseRenewalIntervalInSeconds: 10
  client:
    registryFetchIntervalSeconds: 5
    serviceUrl:
      defaultZone: ${EUREKA_SERVICE_URL:http://localhost:8761}/eureka/

management:
  endpoints:
    web:
      exposure:
        include: "*"
  endpoint:
    health:
      show-details: ALWAYS

config

代码语言:javascript
复制
@Configuration
@EnableAutoConfiguration
@EnableAdminServer
public class AdminServerApplication {

    public static void main(String[] args) {
        SpringApplication.run(AdminServerApplication.class, args);
    }
}

client实例

maven

代码语言:javascript
复制
        <dependency>
            <groupId>de.codecentric</groupId>
            <artifactId>spring-boot-admin-starter-client</artifactId>
            <version>2.0.0</version>
        </dependency>
                <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-actuator</artifactId>
        </dependency>
        <dependency>
            <groupId>org.jolokia</groupId>
            <artifactId>jolokia-core</artifactId>
        </dependency>

配置

代码语言:javascript
复制
spring:
  boot:
    admin:
      client:
        url: http://localhost:8080

这里配置admin server的地址

运行实例

wallboard

wallboard 实例详情

applications

journal

小结

新版前端改用vue.js进行了重构,后端的话,使用event sourcing的原则进行了重构,支持spring5,移除了spring-cloud-starter依赖,另外使用WebClient替代了zuul等等,具体详见spring-boot-admin-changes-with-2-x。

对于client端来说,目前还不能像1.x版本那样依靠Spring Cloud Discovery进行自动注册,目前需要使用spring-boot-admin-starter-client。

doc

  • spring-boot-admin-changes-with-2-x
  • spring-boot-admin/releases/tag/2.0.0
本文参与 腾讯云自媒体同步曝光计划,分享自微信公众号。
原始发表:2018-05-21,如有侵权请联系 cloudcommunity@tencent.com 删除

本文分享自 码匠的流水账 微信公众号,前往查看

如有侵权,请联系 cloudcommunity@tencent.com 删除。

本文参与 腾讯云自媒体同步曝光计划  ,欢迎热爱写作的你一起参与!

评论
登录后参与评论
0 条评论
热度
最新
推荐阅读
目录
  • server实例
    • maven
      • 配置
        • config
        • client实例
          • maven
            • 配置
            • 运行实例
              • wallboard
                • wallboard 实例详情
                  • applications
                    • journal
                    • 小结
                    • doc
                    领券
                    问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档