Skip to content

SqlSessionTemplate bean is not valid for disposal by Spring container (https://github.com/mybatis/spring/issues/77) #78

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 23, 2015
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
#77 : SqlSessionTemplate bean is not valid for disposal by Spring co…
…ntainer (#77)

 Formatting adjusted
  • Loading branch information
mr-serjey committed Aug 18, 2015
commit 91f227b718bbafec0090956be9cce6950052fbbf
34 changes: 17 additions & 17 deletions src/main/java/org/mybatis/spring/SqlSessionTemplate.java
Original file line number Diff line number Diff line change
Expand Up @@ -396,25 +396,25 @@ public List<BatchResult> flushStatements() {
}

/**
* Allow gently dispose bean:
* <pre>
* {@code
*
* <bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
* <constructor-arg index="0" ref="sqlSessionFactory" />
* </bean>
* }
*</pre>
*
* The implementation of {@link DisposableBean} forces spring context to use {@link DisposableBean#destroy()} method instead of {@link SqlSessionTemplate#close()} to shutdown gently.
*
* @see SqlSessionTemplate#close()
* @see org.springframework.beans.factory.support.DisposableBeanAdapter#inferDestroyMethodIfNecessary
* @see org.springframework.beans.factory.support.DisposableBeanAdapter#CLOSE_METHOD_NAME
*/
* Allow gently dispose bean:
* <pre>
* {@code
*
* <bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
* <constructor-arg index="0" ref="sqlSessionFactory" />
* </bean>
* }
*</pre>
*
* The implementation of {@link DisposableBean} forces spring context to use {@link DisposableBean#destroy()} method instead of {@link SqlSessionTemplate#close()} to shutdown gently.
*
* @see SqlSessionTemplate#close()
* @see org.springframework.beans.factory.support.DisposableBeanAdapter#inferDestroyMethodIfNecessary
* @see org.springframework.beans.factory.support.DisposableBeanAdapter#CLOSE_METHOD_NAME
*/
@Override
public void destroy() throws Exception {
//This method forces spring disposer to avoid call of SqlSessionTemplate.close() which gives UnsupportedOperationException
//This method forces spring disposer to avoid call of SqlSessionTemplate.close() which gives UnsupportedOperationException
}

/**
Expand Down