2016-05-01 649 views
0

我要將我的spring引導應用程序註冊到spring-boot-admin服務器。Spring Boot Admin,客戶端註冊導致請求不好

這是我SpringBootAdminApplication.java

@Configuration 
@EnableAutoConfiguration 
@EnableAdminServer 
public class SpringBootAdminApplication { 

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

而且pom.xml

<dependencies> 
    <dependency> 
     <groupId>de.codecentric</groupId> 
     <artifactId>spring-boot-admin-example</artifactId> 
     <version>1.0.5</version> 
    </dependency> 
</dependencies> 

application.properties

server.port = 8080 

服務器現在正在運行:

現在210

enter image description here

,在客戶端:

性質:

spring.boot.admin.url=http://localhost:8080 
[email protected]@ 
spring.application.name=rest-module 

的pom.xml:

<dependency> 
     <groupId>de.codecentric</groupId> 
     <artifactId>spring-boot-admin-starter-client</artifactId> 
     <version>1.3.0</version> 
</dependency> 

但是,當我從客戶端運行的春天開機,我得到此錯誤:

Created POST request for "http://localhost:8080/api/applications" 
Setting request Accept header to [application/json, application/json, application/*+json, application/*+json] 

Writing [Application [id=null, name=rest-module, managementUrl=http://Hayatloo-PC:8082, healthUrl=http://Hayatloo-PC:8082/health, serviceUrl=http://Hayatloo-PC:8082]] as "application/json" using [org.springfr[email protected]1637320b] 
Failed to register application as Application [id=null, name=rest-module, managementUrl=http://Hayatloo-PC:8082, healthUrl=http://Hayatloo-PC:8082/health, serviceUrl=http://Hayatloo-PC:8082] at spring-boot-admin (http://localhost:8080/api/applications): 400 Bad Request 

爲什麼id=null

回答

2

你搞砸了版本。嘗試將客戶端和服務器更新到相同的版本。我們也嘗試保持em兼容,但從1.0.x到1.3.x你都沒有機會。 Btw當前版本是1.3.2。

此外,您正在使用該示例作爲依賴項。這確實有效,但我不會推薦它。您可以按照指南中的描述更好地設置您的服務器。 http://codecentric.github.io/spring-boot-admin/1.3.2/

+0

感謝的答案,但是當我使用指南的依賴關係,我得到的服務器端解決此errro:上de.codecentric.boot.admin.config.HazelcastStoreConfiguration.applicationStore' '錯誤處理條件'拋出:IllegalArgumentException:@ConditionalOnMissingBean註釋必須至少指定一個bean(類型,名稱或註釋)' – Sajad

+0

您是否使用最新的彈簧引導? – joshiste

+0

我的彈簧啓動版本是'1.2.6.RELEASE' – Sajad