Skip to content
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

Use bean factory class loader for deserializing JDBC sessions #610

Closed
wants to merge 1 commit into from

Conversation

vpavic
Copy link
Contributor

@vpavic vpavic commented Sep 1, 2016

This commit addresses the issue with deserializing JDBC sessions in Spring Boot applications that use DevTools. Previously, such configuration would cause ClassCastException when deserializing JDBC sessions due to app class loader being used instead of restart class loader.

See spring-projects/spring-boot#3805 for more background.

* {@link ConversionService}. Applicable only with Spring 4.2.1 or later.
* @param classLoader the bean class loader
*/
public void setClassLoader(ClassLoader classLoader) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

User's might be a bit surprised to find out if the manually invoke setConversionService and then setClassLoader that the ConversionService is overridden.

Perhaps a better approach could be to remove the setClassLoader method and have the configuration class create a default ConversionService with the appropriate ClassLoader if the user has not explicitly provided one.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed @rwinch, that scenario came across my mind today as well.

@rwinch rwinch self-assigned this Sep 2, 2016
@rwinch rwinch added the status: waiting-for-feedback We need additional information before we can continue label Sep 2, 2016
This commit addresses the issue with deserializing JDBC sessions in Spring Boot applications that use DevTools. Previously, such configuration would cause `ClassCastException` when deserializing JDBC sessions due to app class loader being used instead of restart class loader.
@vpavic
Copy link
Contributor Author

vpavic commented Sep 2, 2016

@rwinch I've updated the PR as per your suggestions.

rwinch pushed a commit that referenced this pull request Sep 7, 2016
This commit addresses the issue with deserializing JDBC sessions in Spring Boot
applications that use DevTools. Previously, such configuration would cause
`ClassCastException` when deserializing JDBC sessions due to app class loader
being used instead of restart class loader.

Fixes gh-610
rwinch pushed a commit that referenced this pull request Sep 7, 2016
@rwinch rwinch closed this in cbd9699 Sep 7, 2016
rwinch pushed a commit that referenced this pull request Sep 7, 2016
@rwinch rwinch added type: enhancement A general enhancement in: jdbc and removed status: waiting-for-feedback We need additional information before we can continue labels Sep 7, 2016
@rwinch rwinch added this to the 1.3.0 M1 milestone Sep 7, 2016
@vpavic vpavic deleted the fix-jdbc-classloading branch September 7, 2016 16:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
in: jdbc type: enhancement A general enhancement
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants