SpringBootAdmin 使用教程-初篇

版本信息: (存在即合理)

springboot version:1.5.21
springbootAdmin version:1.5.7

git地址:

         server端:https://gitee.com/chenfan_s/SpringBootAdmin.git

        client端:https://gitee.com/chenfan_s/SpringbootAdminClient.git

搭建server  :(pom文件最好是在创建的时候就选择对应的应用.下面的pom.xml只是部分)

pom.xml 


        org.springframework.boot
        spring-boot-starter-parent
        1.5.21.RELEASE
         
    
 
        1.8
        1.5.7
    


 
        
            org.springframework.boot
            spring-boot-starter-web
        
        
            de.codecentric
            spring-boot-admin-starter-server
        

        
            org.projectlombok
            lombok
            true
        
        
            org.springframework.boot
            spring-boot-starter-test
            test
        
        
            com.alibaba
            fastjson
            1.2.59
        

    
    
        
            
                de.codecentric
                spring-boot-admin-dependencies
                ${spring-boot-admin.version}
                pom
                import
            
        
    

Application.java

@Configuration
@EnableAdminServer
@SpringBootApplication
public class AdminserverApplication {

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

}

启动服务:

SpringBootAdmin 使用教程-初篇_第1张图片

Client端

pom.xml


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

    
        1.8
        1.5.7
    

 
        
            org.springframework.boot
            spring-boot-starter-web
        
        
            de.codecentric
            spring-boot-admin-starter-client
        

        
            org.projectlombok
            lombok
            true
        
        
            org.springframework.boot
            spring-boot-starter-test
            test
        
    

    
        
            
                de.codecentric
                spring-boot-admin-dependencies
                ${spring-boot-admin.version}
                pom
                import
            
        
    


application.properties文件

server.port=8888
spring.boot.admin.client.name=test-api
##开启自动注册
spring.boot.admin.auto-registration=true
##服务自动注册地址
spring.boot.admin.url=http://localhost:8080
##开启客户端
spring.boot.admin.client.enabled=true
##关闭认证
management.security.enabled=false

在保证server服务启动并运行正常的情况下,启动client服务

SpringBootAdmin 使用教程-初篇_第2张图片

 

你可能感兴趣的:(springbootAdmin)