in Education by
I am new to spring, as part of my project implementation, I am supposed to add a spring retry on a service method that invokes JPA repository. Code looks something like below @Retryable(value = {Exception.class},maxAttempts = 1,backoff = @Backoff(300)) public Page findAllAccounts(AccountSearchRequest account, Pageable pageable) { try { return map(accountSearchRepository.findAll(account, pageable)); }catch (Exception e){ System.out.println("SQL EXCEPTION CAUGTH!!!!!!!!!"); } return null; } @Recover public void recover(Exception e){ System.out.println("!!!!!!!!!!!Failed to get connection!!!!!!"); } Database : Postgresql, Application : Java Spring Boot (Exposed Rest API to get all accounts) HikariPool MaximumPoolSize ** : **1 Hikari ConnectionTimeout ** : **1000 JMeter is used to send 10,000 API requests. Problem : I am able to see SQL EXCEPTION CAUGTH!!!!!!!!! prints but i think retry is not working since I am not seeing the recover method's print. am i missing something? Below is the gradle dependencies // https://mvnrepository.com/artifact/org.springframework.retry/spring-retry compile group: 'org.springframework.retry', name: 'spring-retry', version: '1.2.4.RELEASE' // https://mvnrepository.com/artifact/org.springframework/spring-aspects compile group: 'org.springframework', name: 'spring-aspects', version: '3.2.4.RELEASE' // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-aop compile group: 'org.springframework.boot', name: 'spring-boot-starter-aop', version: '2.1.3.RELEASE' // https://mvnrepository.com/artifact/org.springframework/spring-aop compile group: 'org.springframework', name: 'spring-aop', version: '5.1.5.RELEASE' JavaScript questions and answers, JavaScript questions pdf, JavaScript question bank, JavaScript questions and answers pdf, mcq on JavaScript pdf, JavaScript questions and solutions, JavaScript mcq Test , Interview JavaScript questions, JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)

1 Answer

0 votes
by
Thanks for the support. I found the issue was that @Recover method had different data type than the @Retryable. Conditions for Retry to work in the above scenario @Recover and @Retryable should be public and of the same return type

Related questions

0 votes
    I am new to spring, as part of my project implementation, I am supposed to add a spring retry on ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 19, 2022 in Education by JackTerrance
0 votes
    Closed. This question needs debugging details. It is not currently accepting answers. Want to improve this ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 23, 2022 in Education by JackTerrance
0 votes
    I have a problem with Spring and JPA. Basically I try to use JPA with Spring with a pure approach ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 4, 2022 in Education by JackTerrance
0 votes
    I am using spring-boot latest 2.1.3 release and want to start with testcases, but this is not ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 13, 2022 in Education by JackTerrance
0 votes
    I am using spring-boot latest 2.1.3 release and want to start with testcases, but this is not ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 8, 2022 in Education by JackTerrance
0 votes
    I have a @Stateless-Bean which performs some Database operations in a single method public void doOperation() ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 3, 2022 in Education by JackTerrance
0 votes
    I have a @Stateless-Bean which performs some Database operations in a single method public void doOperation() ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    As far as I've experienced JPA/hibernate will return entities that either exists at the database or have ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Jun 18, 2022 in Education by JackTerrance
0 votes
    I created update() method which is using JPA. It looks like this: public boolean update(Programy program) ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 13, 2022 in Education by JackTerrance
0 votes
    I am wanting to understand this Karaf JPA example. When I follow the instructions to add features and run ... Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked May 8, 2022 in Education by JackTerrance
0 votes
    Is it possible to query "UNION" in JPA and even "Criteria Builder"? I'm looking for examples, but ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 24, 2022 in Education by JackTerrance
0 votes
    new to play and just trying to follow the video on: http://www.playframework.org/ I'm coming so ... JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Mar 2, 2022 in Education by JackTerrance
0 votes
    This is a bit of an odd question, but it has been bothering me for a few months now. I have ... , JavaScript Questions for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Feb 19, 2022 in Education by JackTerrance
0 votes
0 votes
    I'm teaching myself the Spring Cloud Config Server and having some trouble with injecting the properties into ... for Interview, JavaScript MCQ (Multiple Choice Questions)...
asked Apr 20, 2022 in Education by JackTerrance
...