-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
Enable spring boot devtools - dgtkit 3.x
- Loading branch information
Showing
7 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
forms/src/main/java/org/devgateway/toolkit/forms/serializer/SpringDevToolsSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package org.devgateway.toolkit.forms.serializer; | ||
|
||
import org.apache.wicket.serialize.ISerializer; | ||
import org.springframework.core.convert.converter.Converter; | ||
import org.springframework.core.serializer.DefaultDeserializer; | ||
import org.springframework.core.serializer.support.DeserializingConverter; | ||
import org.springframework.core.serializer.support.SerializingConverter; | ||
|
||
/** | ||
* A custom serializer is needed to support Spring Boot Devtools. Spring Boot Devtools | ||
* has some limitation with support of serialisation/deserialization support. So we have to | ||
* provide a custom Wicket {@link ISerializer}. | ||
* | ||
* <p> | ||
* <b>20.2.6 Known limitations</b> <br> | ||
* Restart functionality does not work well with objects that are deserialized using a | ||
* standard ObjectInputStream. If you need to deserialize data, you may need to use Spring’s | ||
* ConfigurableObjectInputStream in combination with Thread.currentThread().getContextClassLoader(). | ||
* Unfortunately, several third-party libraries deserialize without considering the context classloader. | ||
* If you find such a problem, you will need to request a fix with the original authors. | ||
* </p> | ||
* | ||
* @author Marc Giffing | ||
* @see <a href="https://github.com/spring-projects/spring-boot/issues/3805">Spring Boot Devtools Serializer Issue</a> | ||
*/ | ||
public class SpringDevToolsSerializer implements ISerializer { | ||
|
||
private Converter<Object, byte[]> serializer = new SerializingConverter(); | ||
private Converter<byte[], Object> deserializer; | ||
|
||
public SpringDevToolsSerializer() { | ||
this.deserializer = new DeserializingConverter(new DefaultDeserializer(Thread.currentThread() | ||
.getContextClassLoader())); | ||
} | ||
|
||
@Override | ||
public byte[] serialize(final Object object) { | ||
return serializer.convert(object); | ||
} | ||
|
||
@Override | ||
public Object deserialize(final byte[] data) { | ||
return deserializer.convert(data); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
restart.include.wicket-annotation=/wicketstuff-annotation-[\\w-\.]+\.jar | ||
restart.include.wicket-spring=/wicket-spring-[\\w-\.]+\.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters