以下代碼不會重試。我錯過了什麼?Springboot @retryable not retrying
@EnableRetry
@SpringBootApplication
public class App implements CommandLineRunner
{
.........
.........
@Retryable()
ResponseEntity<String> authenticate(RestTemplate restTemplate, HttpEntity<MultiValueMap<String, String>> entity) throws Exception
{
System.out.println("try!");
throw new Exception();
//return restTemplate.exchange(auth_endpoint, HttpMethod.POST, entity, String.class);
}
我已將以下內容添加到pom.xml中。
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
<version>1.1.2.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
我也試着給@Retryable提供不同的參數組合。
@Retryable(maxAttempts=10,value=Exception.class,[email protected](delay = 2000,multiplier=2))
謝謝。
我正面臨同樣的問題。 –