SpringRestPactRunner doesn't appear to call destroyMethod on Spring beans
See original GitHub issueI have a Pact test using SpringRestPactRunner
that passes when I run it standalone.
Elsewhere in my app I have a @Bean
annotation with a destroyMethod
parameter to control my HazelcastInstance.
@Bean(destroyMethod= "shutdown")
public HazelcastInstance hazelcastInstance() {
LOGGER.info("Starting Hazelcast");
return Hazelcast.newHazelcastInstance(config());
}
In my other functional tests I can see in the logs that Hazelcast starts and stops correctly.
However, in my pact test Hazelcast is never shut down - this causes my Maven build to fail as the next test tries to start Hazelcast and the application fails with an exception at that point as it’s already running.
My thinking is that when I use the SpringRestPactRunner
it’s not calling the destroyMethod
from the @Bean
annotation.
Issue Analytics
- State:
- Created 5 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
SpringRestPactRunner doesn't appear to call destroyMethod ...
My thinking is that when I use the SpringRestPactRunner it's not calling the destroyMethod from the @Bean annotation. The text was updated ...
Read more >Destroy method is not working in spring framework [duplicate]
Destroy method is not called for beans of scope prototype. This is because the context doesn't keep track of the prototype scope objects...
Read more >3.6 Customizing the nature of a bean - Spring
When you write initialization and destroy method callbacks that do not use the Spring-specific InitializingBean and DisposableBean callback interfaces, ...
Read more >Bean life cycle in Java Spring - GeeksforGeeks
Here, we will use init() method to execute all its code as the spring container starts up and the bean is instantiated, and...
Read more >Spring - Bean Life Cycle - Tutorialspoint
Similarly, destroymethod specifies a method that is called just before a bean is removed from the container. Initialization callbacks. The org.springframework.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
3.5.19 has been released with this fix
Thanks, this has fixed the issue.