小编san*_*nit的帖子

注解方式注册监听到spring的@Retryable

如何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. 因此,如果我有多个侦听器,那么如何要求特定侦听器侦听我的可重试服务?

java spring-retry

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

<link rel ="stylesheet"href ="../ css/style.css">无效

我有css文件夹下的css文件和jsp文件夹下的jsp文件,两个文件夹都在WEB-INF文件夹中.那我怎样才能在jsp中获取css文件?

  <link rel="stylesheet" href="../css/style.css>
Run Code Online (Sandbox Code Playgroud)

我已经给出了这样的道路.

html css jsp

-3
推荐指数
1
解决办法
7万
查看次数

标签 统计

css ×1

html ×1

java ×1

jsp ×1

spring-retry ×1