When using the spring boot dev tools library the are some problems with class loaders, mainly:
The problem is that there are two class loaders for dedicated class. When load the class from memcache and map/cast to object of class there is an exception like
java.lang.ClassCastException: class xxx.api.cache.CachedResponse cannot be cast to class xxx.api.cache.CachedResponse (xxx.api.cache.CachedResponse is in unnamed module of loader 'app'; xxx.api.cache.CachedResponse is in unnamed module of loader org.springframework.boot.devtools.restart.classloader.RestartClassLoader @2f6f8549)
I have tried to exclude CachedResponse
class from restart or some how from RestartClassLoader
but I did not manage to me.
I have used
restart.exclude.classes=file:/app/build/classes/java/main/
property but it exclude all classed in classpath. I have tried to exclude specific class CachedResponse
but no results.
Also I have tried to include the folsom jar to RestartClassLoader
but did not work.
Is there a possibility to exclude that CachedResponse
class from RestartClassLoader
?