小编eng*_*ngg的帖子

Springboot @retryable没有重试

以下代码未重试.我错过了什么?

@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 maven spring-retry spring-boot

10
推荐指数
6
解决办法
2万
查看次数

如何在JExcel(jxl)中将格式化的数字写为数字

我正在使用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时再次给它们格式化.

请帮忙.谢谢.

java excel spring jxl jexcelapi

8
推荐指数
2
解决办法
1万
查看次数

标签 统计

java ×2

spring ×2

excel ×1

jexcelapi ×1

jxl ×1

maven ×1

spring-boot ×1

spring-retry ×1