You Could use the following
-
destroy-method
as @amir75 recommends -
@PreDestroy annotation
-
Implement DisposableBean and override destroy method.
All the deatails about these can be found at Disposable Callbacks.
More Related Contents:
- @RequestParam vs @PathVariable
- How to use JNDI DataSource provided by Tomcat in Spring?
- Getting Spring Application Context
- Difference between @Valid and @Validated in Spring
- Configuring Spring Security 3.x to have multiple entry points
- After Spring Boot 2.0 migration: jdbcUrl is required with driverClassName
- Increase HTTP Post maxPostSize in Spring Boot
- Implement converters for entities with Java Generics
- Calling a @Bean annotated method in Spring java configuration
- Configure active profile in SpringBoot via Maven
- How to change Spring’s @Scheduled fixedDelay at runtime?
- Redirect in Spring MVC
- Inject bean into enum
- How to get access to job parameters from ItemReader, in Spring Batch?
- Spring: define @RequestMapping value in a properties file
- How to replace table name with parameter value while using Spring Data JPA nativeQuery
- Spring cron expression for every day 1:01:am
- Configure DataSource programmatically in Spring Boot
- What is the default scheduler pool size in spring-boot?
- Injecting @Autowired private field during testing
- Difference between Interceptor and Filter in Spring MVC
- Spring Boot, logback and logging.config property
- JPQL Like Case Insensitive
- Why HibernateTemplate isn’t recommended? [duplicate]
- Adding Dynamic Number of Listeners(Spring JMS)
- Response for preflight has invalid HTTP status code 401 – Spring
- How to setup Hibernate to read/write to different datasources?
- Programmatically restart Spring Boot application / Refresh Spring Context
- Could not initialize proxy – no Session
- Custom Authentication Manager with Spring Security and Java Configuration