spring-projects / spring-boot

Spring Boot
https://spring.io/projects/spring-boot
Apache License 2.0
73.61k stars 40.32k forks source link

Closing org.springframework.web.context.support.GenericWebApplicationContext issue during running Test class #41254

Closed lovinjv closed 22 hours ago

lovinjv commented 1 week ago

I have recently migrated a springboot v2.7.5 application which uses spring batch to spring boot v3 with jdk 17 . I have a test class which uses @SpringBootTest and one of the test method executes a flow of running a job , running tasklet and running Listener. I am using 2 data sources(h2) . While the tasklet is executed , I get a warning "Closing org.springframework.web.context.support.GenericWebApplicationContext" and Hikari pools starts shutting down resulting in below exception: "Closing connection (connection evicted)" When i run the same tests in older version v2.7.5 , the GenericWebApplicationContext is closed after full flow is executed .

wilkinsona commented 1 week ago

Thanks for the report. Unfortunately, it doesn't contain enough information for us to be able to help you. From what you've described thus far, it sounds like the change in behavior is likely to be due to a change in Spring Batch but that's just a guess at this point. If you would like us to spend some more time investigating, please spend some time providing a complete yet minimal sample that reproduces the problem. You can share it with us by pushing it to a separate repository on GitHub or by zipping it up and attaching it to this issue.

lovinjv commented 1 week ago

@wilkinsona Sharing a poc to reproduce may take some time but meanwhile can you suggest if we can use @SpringBatchTest for writing unit test if we have more that one Job. I had referred to https://github.com/spring-projects/spring-batch/issues/3699

philwebb commented 1 week ago

@lovinjv We don't really have the necessary experience with Spring Batch to be able to offer any deep advice with their codebase. Please ask on stackoverflow.com.

spring-projects-issues commented 1 day ago

If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.

lovinjv commented 1 day ago

you can close the issue . I was able to find a solution.

wilkinsona commented 22 hours ago

Thanks for letting us know, @lovinjv.