如何spring-retry使用@Retryable()注解注册监听器?
@Bean
public RetryListener myRetryListener() {
return new MyRetryListener();
}
@Service
public class SampleService {
private int cnt = 1;
@Retryable(RuntimeException.class)
public void retryMethod(int x) throws Exception {
System.out.println("SampleService invoked.");
Thread.sleep(500);
if (cnt++ < 4) {
throw new RuntimeException("SampleService throwing exception");
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果我创建任何侦听器 bean,它会自动注册到RetryTemplate. 因此,如果我有多个侦听器,那么如何要求特定侦听器侦听我的可重试服务?
我有css文件夹下的css文件和jsp文件夹下的jsp文件,两个文件夹都在WEB-INF文件夹中.那我怎样才能在jsp中获取css文件?
<link rel="stylesheet" href="../css/style.css>
Run Code Online (Sandbox Code Playgroud)
我已经给出了这样的道路.