以下代码未重试.我错过了什么?
@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);
}
Run Code Online (Sandbox Code Playgroud)
我已将以下内容添加到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>
Run Code Online (Sandbox Code Playgroud)
我也试过为@Retryable提供不同的参数组合.
@Retryable(maxAttempts=10,value=Exception.class,backoff=@Backoff(delay = 2000,multiplier=2))
Run Code Online (Sandbox Code Playgroud)
谢谢.
我正在使用Java Spring和jxl在服务器端创建Excel工作簿.需要在Excel中显示的数据包含已格式化的数字.我在用
WritableCellFormat wcf = new WritableCellFormat();
wcf.setAlignment(Alignment.RIGHT);
....
....
sheet.addCell(new Label(j, i + 1, xxx, wcf));
//where xxx is a string which is a number already formatted
Run Code Online (Sandbox Code Playgroud)
在下载的excel文件中,所有这些数字都存储为文本,因此Excel不能在它们上使用公式,它会发出警告"数字存储为文本",我必须做'转换为数字'.
在jxl中,我们可以传递字符串并告诉它们将它们解释为数字吗?我拥有的所有数字都是使用$,%,千位分隔符格式化的有效数字.我不想将它们转换为有效数字,并在导出到excel时再次给它们格式化.
请帮忙.谢谢.