Class loading is broken with Spring Boot's DevTools again.
See original GitHub issueHello Luke,
Sadly #331 introduced a regression of #267.
That became apparent in a change of Neo4j-OGM where we now rely on ClassGraph being able to find scanned classes.
Find attached a reproducer:
try(ScanResult r = new ClassGraph()
.ignoreClassVisibility()
.whitelistPackages("com.example.gh729.domain")
.scan()) {
for(ClassInfo classInfo : r.getAllClasses()) {
if("com.example.gh729.domain.SomeClass".equals(classInfo.getName())) {
SomeClass f = (SomeClass) classInfo.loadClass().getConstructor().newInstance();
}
}
}
This works in 4.8.17 and starts to fail in 4.8.19 again (as before my contribution).
This is the expected order of class loaders withorg.springframework.boot.devtools.restart.classloader.RestartClassLoader
present
This is now what I get in 4.8.19+
Both screenshots from debugging into io.github.classgraph.ClassGraphClassLoader
and displaying the order of class loaders used.
Find the reproducer attached. Open in your IDE and run Gh729Application
.
Related OGM ticket is https://github.com/neo4j/neo4j-ogm/issues/729
Issue Analytics
- State:
- Created 4 years ago
- Comments:15 (15 by maintainers)
Top Results From Across the Web
java - spring-boot-devtools causing ClassCastException while ...
This is a known limitation of Devtools. When the cache entry is deserialized, the object is not attached to the proper classloader.
Read more >IntelliJ IDEA Fix Spring Boot DevTools not working - YouTube
How to fix the problem of Spring Boot DevTools not working in IntelliJ IDEA: automatic restart does not trigger and changes to static ......
Read more >Developing with Spring Boot
If your application is launched from java -jar or if it is started from a special classloader, then it is considered a “production...
Read more >Fixing classloader problems with Spring Devtools ... - Life in IDE
While for RedissonNode the class loader is AppClassLoader what's one level up before RestartClassLoader (it's RestartClassLoader.getParent() ).
Read more >Spring Boot - Tutorial - Vogella.com
Create a new package with the name com.vogella.spring.issues.controller in the src/main/java folder. In there, create the following Class IssueController .
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Actually now that I understand the Restart classloader better, I made some further cleanups to simplify the
ClassLoaderHandler
in the last commit. Please check also that 4.8.61-SNAPSHOT (the git master version) works for you in addition to 4.8.60. (The master version should also work fine.)Great work, Luke! I can confirm both 4.8.60 and 4.8.61-SNAPSHOT works.