我正在尝试通过Spring Boot注册我的Spring Boot Client应用程序 管理员,使用http://localhost:8081作为spring.boot.admin.url时 客户端应用程序已成功向admin应用程序注册的属性。 但是,当我在weblogic上部署时,我收到401的未授权异常 客户。
**Below is the settings when deploying on weblogic.**
I have used version 1.5.6 for the Spring boot admin dependencies.
**Spring boot Admin pom.xml**
<groupId>za.co.test.springbootadmin</groupId>
<artifactId>spring-boot-admin</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>**war**</packaging>
<name>spring-boot-admin</name>
<description>Spring Boot Admin</description>
<dependencies>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui-login</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-server-ui</artifactId>
<version>1.5.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-security</artifactId>
</dependency>
</dependencies>
Below is the application.properties for the Spring Boot Admin app.
**application.properties**
spring.application.name=springbootadmin
server.port=8081
management.security.enabled=false
security.user.name=admin
security.user.password=admin
**Below is the pom.xml for Spring boot admin client**
<groupId>za.co.test.client</groupId>
<artifactId>spring-boot-admin</artifactId>
<version>1.1.0</version>
<packaging>war</packaging>
<name>SpringBootClient</name>
<description>Spring Boot client</description>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>1.5.8.RELEASE</version>
<relativePath/>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator-docs</artifactId>
</dependency>
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-rest</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>1.5.6</version>
</dependency>
</dependencies>
**Below is the Spring Boot Admin client application.properties**
server.port=8091
######### ACTUATOR SETTINGS #########
management.context-path=/admin
management.security.enabled=false
######SPRING BOOT ADMIN SETTINGS######
spring.boot.admin.url=http://192.168.1.5:7002/spring-
boot-admin
spring.boot.admin.username=admin
spring.boot.admin.password=admin
spring.boot.admin.client.name=springBootClient
security.user.name=admin
security.user.password=admin
spring.boot.admin.client.service-base-
url=http://192.168.1.5:7002/spring-boot-admin
**Error Message:**
Failed to register application as Application [name=springBootClient,
managementUrl=http://192.168.1.5:7002/spring-boot-admin/admin/, healthUrl=http://192.168.1.5:7002/spring-boot-admin/admin/health/, serviceUrl=http://192.168.1.5:7002/spring-boot-admin/] at spring-boot-admin ([http://192.168.1.5:7002/spring-boot-admin/api/applications]): 401 Unauthorized.
通过Spring boot admin应用程序在weblogic上正常启动。
谢谢