5

我正在使用 io.github.resilience4j。1.6.1 版本一切正常,但升级到 1.7.1 版本时,我的应用程序没有运行。请在下面找到我的代码更改。

我的 pom.xml 依赖项

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

这是 application.propertes 更改

resilience4j.circuitbreaker.configs.default.registerHealthIndicator=true
resilience4j.circuitbreaker.configs.default.slidingWindowSize= 10
resilience4j.circuitbreaker.configs.default.minimumNumberOfCalls=5
resilience4j.circuitbreaker.configs.default.permittedNumberOfCallsInHalfOpenState= 3
resilience4j.circuitbreaker.configs.default.automaticTransitionFromOpenToHalfOpenEnabled=true
resilience4j.circuitbreaker.configs.default.waitDurationInOpenState=5s
resilience4j.circuitbreaker.configs.default.failureRateThreshold=50
resilience4j.circuitbreaker.configs.default.eventConsumerBufferSize=10
resilience4j.circuitbreaker.configs.shared.slidingWindowSize=100
resilience4j.circuitbreaker.configs.shared.permittedNumberOfCallsInHalfOpenState=30
resilience4j.circuitbreaker.configs.shared.waitDurationInOpenState=1s
resilience4j.circuitbreaker.configs.shared.failureRateThreshold=50
resilience4j.circuitbreaker.configs.shared.eventConsumerBufferSize=10
resilience4j.circuitbreaker.instances.profile.registerHealthIndicator=true
resilience4j.circuitbreaker.instances.profile.slidingWindowSize=10
resilience4j.circuitbreaker.instances.profile.minimumNumberOfCalls=10
resilience4j.circuitbreaker.instances.profile.permittedNumberOfCallsInHalfOpenState=3
resilience4j.circuitbreaker.instances.profile.waitDurationInOpenState=5s
resilience4j.circuitbreaker.instances.profile.failureRateThreshold=50
resilience4j.circuitbreaker.instances.profile.eventConsumerBufferSize=10

resilience4j.retry.configs.default.maxAttempts=3
resilience4j.retry.configs.default.waitDuration=100
resilience4j.retry.instances.profile.baseConfig=default

resilience4j.bulkhead.configs.default.maxConcurrentCalls=30
resilience4j.bulkhead.configs.instances.profile.maxWaitDuration=10ms
resilience4j.bulkhead.configs.instances.profile.maxConcurrentCalls=20

resilience4j.thread-pool-bulkhead.configs.default.maxThreadPoolSize=4
resilience4j.thread-pool-bulkhead.configs.default.coreThreadPoolSize=2
resilience4j.thread-pool-bulkhead.configs.default.queueCapacity=2
resilience4j.thread-pool-bulkhead.instances.profile.maxThreadPoolSize=1
resilience4j.thread-pool-bulkhead.instances.profile.coreThreadPoolSize=1
resilience4j.thread-pool-bulkhead.instances.profile.queueCapacity=1

resilience4j.ratelimiter.configs.default.registerHealthIndicator=false
resilience4j.ratelimiter.configs.default.limitForPeriod=10
resilience4j.ratelimiter.configs.default.limitRefreshPeriod=1s
resilience4j.ratelimiter.configs.default.timeoutDuration=0
resilience4j.ratelimiter.configs.default.eventConsumerBufferSize=100

resilience4j.timelimiter.configs.default.cancelRunningFuture=false
resilience4j.timelimiter.configs.default.timeoutDuration=2s
resilience4j.timelimiter.instances.profile.baseConfig=default

这是控制器 API 更改

private static final String PROFILE="profile";    


@GetMapping("/{programType}/profile")
@AdobeIOAuthentication
@RateLimiter(name = PROFILE)
@TimeLimiter(name = PROFILE)
@CircuitBreaker(name = PROFILE)
@Bulkhead(name = PROFILE)

我在构建时遇到的错误

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2021-08-11 14:37:21.503 IST ERROR requestId=NA x-correlation-id=NA 17200 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   : 

***************************
APPLICATION FAILED TO START
***************************

Description:

An attempt was made to call a method that does not exist. The attempt was made from the following location:

    io.github.resilience4j.spelresolver.autoconfigure.SpelResolverConfigurationOnMissingBean.spelResolver(SpelResolverConfigurationOnMissingBean.java:54)

The following method did not exist:

    'io.github.resilience4j.spelresolver.SpelResolver io.github.resilience4j.spelresolver.configure.SpelResolverConfiguration.spelResolver(org.springframework.expression.spel.standard.SpelExpressionParser, org.springframework.core.ParameterNameDiscoverer, org.springframework.beans.factory.BeanFactory)'

The method's class, io.github.resilience4j.spelresolver.configure.SpelResolverConfiguration, is available from the following locations:

    jar:file:/C:/Users/169576/.m2/repository/io/github/resilience4j/resilience4j-spring/1.6.0/resilience4j-spring-1.6.0.jar!/io/github/resilience4j/spelresolver/configure/SpelResolverConfiguration.class

The class hierarchy was loaded from the following locations:

    io.github.resilience4j.spelresolver.configure.SpelResolverConfiguration: file:/C:/Users/169576/.m2/repository/io/github/resilience4j/resilience4j-spring/1.6.0/resilience4j-spring-1.6.0.jar

有人可以帮我解决这个问题。

4

1 回答 1

5

尝试版本 1.7.0

<dependency>
    <groupId>io.github.resilience4j</groupId>
    <artifactId>resilience4j-core</artifactId>
    <version>1.7.0</version>
</dependency>
<dependency>
    <groupId>io.github.resilience4j</groupId>
    <artifactId>resilience4j-spring-boot2</artifactId>
    <version>1.7.0</version>
</dependency>
于 2021-10-09T10:24:50.287 回答