Spring Boot 在您的配置中定义类型为“com.netflix.discovery.AbstractDiscoveryClientOptionalArgs”的Bean

dm7nw8vv  于 2022-11-05  发布在  Spring
关注(0)|答案(1)|浏览(153)

我正在将我的应用程序从Sping Boot 版本1.5.22.RELEASE迁移到2.5.5以修复漏洞。在一个缓存定位器模块中,我正在使用spring-boot-starter-data-gemfire 1.5.22.RELEASE沿着com.gemstone.gemfire:gemfire:8.2.7、spring-cloud-starter-netflix-eureka-client版本3.1.0,以及其他Spring框架依赖项,如-

<dependencies>
  <dependency>
     <groupId>org.springframework.boot</groupId>
     <artifactId>spring-boot-starter-data-gemfire</artifactId>
     <version>1.5.22.RELEASE</version>
     <exclusions>
       <exclusion>
           <groupId>com.gemstone.gemfire</groupId>
           <artifactId>gemfire</artifactId>
       </exclusion>
       <exclusion>
           <groupId>com.gemstone.gemfire</groupId>
           <artifactId>gemfire</artifactId>
       </exclusion>
       <exclusion>
           <groupId>ch.qos.logback</groupId>
           <artifactId>logback-core</artifactId>
       </exclusion>
       <exclusion>
           <groupId>com.fasterxml.jackson.core</groupId>
           <artifactId>jackson-databind</artifactId>
       </exclusion>
       <exclusion>
           <groupId>ch.qos.logback</groupId>
           <artifactId>logback-classic</artifactId>
       </exclusion>
       <exclusion>
           <groupId>org.apache.logging.log4j</groupId>
           <artifactId>log4j-to-slf4j</artifactId>
       </exclusion>
     </exclusions>
   </dependency>

   <dependency>
       <groupId>com.fasterxml.jackson.core</groupId>
       <artifactId>jackson-databind</artifactId>
       <version>2.13.2.1</version>
   </dependency>
   <dependency>
       <groupId>com.fasterxml.jackson.core</groupId>
       <artifactId>jackson.core</artifactId>
       <version>2.13.1</version>
   </dependency>
   <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>slf4j-api</artifactId>
       <scope>compile</scope>
   </dependency>
   <dependency>
       <groupId>org.slf4j</groupId>
       <artifactId>jcl-over-slf4j</artifactId>
   </dependency>
   <dependency>
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-core</artifactId>
       <version>1.2.7</version>
   </dependency>
   <dependency>
       <groupId>ch.qos.logback</groupId>
       <artifactId>logback-classic</artifactId>
       <scope>runtime</scope>
   </dependency>

  <dependency>
     <groupId>org.springframework.cloud</groupId>
     <artifactId>spring-cloud-starter-netflix-eureka-client</artifactId>
     <version>3.1.0</version>
     <exclusions>
       <exclusion>
           <groupId>org.bouncycastle</groupId>
           <artifactId>bcprov-jdk15on</artifactId>
       </exclusion>
       <exclusion>
           <groupId>com.thoughtworks.xstream</groupId>
           <artifactId>xstream</artifactId>
       </exclusion>
       <exclusion>
           <groupId>com.google.code.gson</groupId>
           <artifactId>gson</artifactId>
       </exclusion>
       <exclusion>
           <groupId>org.apache.tomcat.embed</groupId>
           <artifactId>tomcat-embed-core</artifactId>
       </exclusion>
       <exclusion>
           <groupId>org.hibernate</groupId>
           <artifactId>hibernate-validator</artifactId>
       </exclusion>
       <exclusion>
           <groupId>io.netty</groupId>
           <artifactId>netty-codec-http</artifactId>
       </exclusion>
       <exclusion>
           <groupId>org.apache.httpcomponents</groupId>
           <artifactId>httpclient</artifactId>
       </exclusion>
     </exclusions>
   </dependency>

   <dependency>
       <groupId>org.apache.httpcomponents</groupId>
       <artifactId>httpclient</artifactId>
       <version>4.5.13</version>
   </dependency>
   <dependency>
       <groupId>org.hibernate</groupId>
       <artifactId>hibernate-validator</artifactId>
       <version>6.1.5.Final</version>
   </dependency>
   <dependency>
       <groupId>com.thoughtworks.xstream</groupId>
       <artifactId>xstream</artifactId>
       <version>1.4.19</version>
   </dependency>
   <dependency>
       <groupId>org.bouncycastle</groupId>
       <artifactId>bcprov-jdk15on</artifactId>
       <version>1.67</version>
   </dependency>

   <dependency>
       <groupId>com.gemstone.gemfire</groupId>
       <artifactId>gemfire</artifactId>
       <version>8.2.7</version>
   </dependency>
   <dependency>
       <groupId>commons-io</groupId>
       <artifactId>commons-io</artifactId>
       <version>2.7</version>
   </dependency>

   <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-core</artifactId>
       <version>5.3.20</version>
   </dependency>
   <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-beans</artifactId>
       <version>5.3.20</version>
   </dependency>
   <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-context</artifactId>
       <version>5.3.20</version>
   </dependency>
   <dependency>
       <groupId>org.springframework</groupId>
       <artifactId>spring-expression</artifactId>
       <version>5.3.18</version>
   </dependency>
       <groupId>org.springframework.boot</groupId>
       <artifactId>spring-boot-properties-migrator</artifactId>
       <version>2.5.5</version>
   </dependency>
 </dependencies>

<build>
   <plugins>
       <plugin>
             <groupId></groupId>
             <artifactId></artifactId>
             <executions>
                 <execution>
                     <goals>
                         <goal>build-info</goal>
                     </goals>
                 </execution>
             </executions>
       </plugin>
   </plugins>
</build>

此模块的主类为-

@SpringBootApplication
@ImportResource({"gemfire-locator.xml"})
@EnableEncryptableProperties
public class LocatorApp {
  public static void main(final String[] args) { 
       SpringApplication.run(LocatorApp.class, args);
  }
}

我已在www.example.com文件中将application-local.properties此模块的配置定义为-


# spring.profiles.active=local

# spring.profiles.include=pulse.authentication.custom

spring.profiles.groups.local=pulse.authentication.custom

spring.application.name=gemfirelocator
server.hostname=#{T.........}
server.port=9020
gemfire.properties.location=/gemfire/gemfire-locator-local.properties
data.location=.

当我尝试启动此服务时,收到以下错误-

Field optionalArgs in org.springframework.cloud.netflix.eureka.EurekaClientAutoConfiguration$RefreshableEurekaClientConfiguration required a bean of type 'com.netflix.discovery.AbstractDiscoveryClientOptionalArgs' in your configuration.

  The injection point has following annotations:
   @org.springframework.beans.factory.annotation.Autowired(required=true)

我已经尝试改变和尝试与其他版本的netflix-eureka-客户端,我也试图删除这个pom.xml文件中的依赖关系的许多排除,但没有帮助启动我的服务,我能够运行与Spring Boot 版本1.5.22.RELEASE.
如何解决此问题?

vm0i2vca

vm0i2vca1#

我的问题是缺少Web依赖项。您可以将以下依赖项添加到pom.xml文件中。

<dependency>
      <groupId>org.springframework.boot</groupId>
      <artifactId>spring-boot-starter-web</artifactId>
   </dependency>

相关问题