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

Spring Boot Devtools-friendly default task data serializer #182

Merged

Conversation

k-jamroz
Copy link

Default java serializer does not work correctly with Spring Boot Devtools. During deserialization ClassCastExceptions are thrown. That is because ObjectInputStream does not use correct class loader (classloaders in devtools are more complicated). See: https://docs.spring.io/spring-boot/docs/current/reference/htmlsingle/#using-boot-devtools-known-restart-limitations

if (serializedData == null)
return null;
try (ByteArrayInputStream bis = new ByteArrayInputStream(serializedData);
ObjectInput in = new ConfigurableObjectInputStream(bis, Thread.currentThread().getContextClassLoader())) {
Copy link
Author

Choose a reason for hiding this comment

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

this is the only difference with Serializer.DEFAULT_JAVA_SERIALIZER

@kagkarlsson
Copy link
Owner

Thank you for contributing! Will have a look as soon as I get the time. I have heard about this from other users, so I appreciate a fix 👍

Copy link
Owner

@kagkarlsson kagkarlsson left a comment

Choose a reason for hiding this comment

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

LGTM 👍

@kagkarlsson kagkarlsson merged commit 5c7e225 into kagkarlsson:master Feb 21, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants