spring boot admin2.0上手

首先创建一个springboot项目基于2.x  pom文件如下 作为spring boot admin服务端



    4.0.0

    com.example
    demo
    0.0.1-SNAPSHOT
    jar

    demo
    Demo project for Spring Boot

    
        org.springframework.boot
        spring-boot-starter-parent
        2.0.3.RELEASE
         
    

    
        UTF-8
        UTF-8
        1.8
    

    
        
            de.codecentric
            spring-boot-admin-starter-server
            2.0.1
        
        
            de.codecentric
            spring-boot-admin-server-ui
            2.0.1
        
    

    
        
            
                org.springframework.boot
                spring-boot-maven-plugin
            
        
    

springboot启动类

@Configuration
@EnableAutoConfiguration
@EnableAdminServer
public class DemoApplication {

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

application.properties配置文件

server.port=1125
spring.application.name= admin2.0

再创建一个项目作为 client客户端 pom文件如下



    4.0.0

    com.example
    demo
    0.0.1-SNAPSHOT
    jar

    demo
    Demo project for Spring Boot

    
        org.springframework.boot
        spring-boot-starter-parent
        2.0.3.RELEASE
         
    

    
        UTF-8
        UTF-8
        1.8
    

    
        
            org.springframework.boot
            spring-boot-starter
        

        
            org.springframework.boot
            spring-boot-starter-test
            test
        
        
            de.codecentric
            spring-boot-admin-starter-client
            2.0.1
        

        
            org.springframework.boot
            spring-boot-starter-actuator
        

        
            org.springframework.boot
            spring-boot-starter-web
        
    

    
        
            
                org.springframework.boot
                spring-boot-maven-plugin
            
        
    



application.properties配置文件

server.port=1126
spring.application.name=Spring Boot Client
spring.boot.admin.client.url=http://localhost:1125
management.endpoints.web.exposure.include=*

先启动springbootadmin 再启动springbootadminclient 

浏览器输入localhost:1125即可 点击即可

spring boot admin2.0上手_第1张图片

spring boot admin2.0上手_第2张图片

ok简单的搭建已经ok了 下一篇我发一些进阶的内容

你可能感兴趣的:(java,spring,cloud,springboot,springcloud)