简体   繁体   中英

resilience4j + spring boot 2 + EndpointAutoConfiguration class not found exception

Resilience4j version: 1.1.0

Java version: 1.8

Spring boot: 2.2.0

I am trying to configure the Resilience4j with spring boot project but getting below class not found

org.springframework.boot.SpringApplication: Application run failed java.lang.IllegalArgumentException: Could not find class [ org.springframework.boot.actuate.autoconfigure.endpoint.EndpointAutoConfiguration ] at org.springframework.util.ClassUtils.resolveClassName(ClassUtils.java:327)

Java Code as follows :

@RateLimiter(name ="service1",fallbackMethod = "rateLimiterfallback")
    @PostMapping(value = "${URL_AUTH}")
    public ResponseEntity<AuthRespDTO> fetchToken(@RequestParam("userId") String Id, @RequestParam("password") String pwd, HttpServletRequest httpRequest) { 
    }

application.yml as below

resilience4j.ratelimiter:
    instances:
    service1:
      limitForPeriod: 1
      limitRefreshPeriod: 100000
      timeoutDuration: 1000ms

I have below dependencies mentioned in POM.xml.

<dependency>
    <groupId>io.github.resilience4j</groupId>
    <artifactId>resilience4j-spring-boot2</artifactId>
    <version>1.1.0</version>
</dependency>

<dependency>
    <groupId>io.github.resilience4j</groupId>
    <artifactId>resilience4j-ratelimiter</artifactId>
    <version>1.1.0</version>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-actuator</artifactId>
    <version>2.2.0.RELEASE</version>
</dependency>

Please help me in resolving the issue.

For fixing this issue you have to update the POM with the spring-boot-starter-actuator and spring-boot-starter-aop dependencies.

At present you have a dependency of spring-boot-actuator which should be updated to spring-boot-starter-actuator .

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-aop</artifactId>
    <version>2.3.0.RELEASE</version>
</dependency>

<dependency>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-actuator</artifactId>
    <version>2.3.2.RELEASE</version>
</dependency>

Note: Release version of spring boot depends on your project.

Similar issue reference

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM