groovyintellij-ideagradlespring-bootspring-loaded

springloaded with Gradle, Groovy and spring-boot fails with java.lang.NoSuchFieldException: classCache


I've successfully setup a spring-boot-groovytemplates and actuator project. However, when adding springloaded to buildscript/dependencies block, I get the following stracktrace when recompiling in IDEA

java.lang.NoSuchFieldException: classCache
    at java.lang.Class.getDeclaredField(Class.java:1918)
    at org.springsource.loaded.agent.SpringPlugin.clearCachedIntrospectionResults(SpringPlugin.java:162)
    at org.springsource.loaded.agent.SpringPlugin.reloadEvent(SpringPlugin.java:127)
    at org.springsource.loaded.TypeRegistry.fireReloadEvent(TypeRegistry.java:1767)
    at org.springsource.loaded.ReloadableType.loadNewVersion(ReloadableType.java:405)
    at org.springsource.loaded.TypeRegistry.loadNewVersion(TypeRegistry.java:845)
    at org.springsource.loaded.agent.ReloadableFileChangeListener.fileChanged(ReloadableFileChangeListener.java:51)
    at org.springsource.loaded.agent.Watcher.determineChangesSince(FileSystemWatcher.java:235)
    at org.springsource.loaded.agent.Watcher.run(FileSystemWatcher.java:219)
    at java.lang.Thread.run(Thread.java:695)

Any clues?


Solution

  • You don't mention which versions of Spring Framework or Spring Loaded you're using, but I would guess that you're trying to use Spring Loaded 1.2.0 with Spring Framework 4.1. It looks like you've hit this bug in Spring Loaded. You should upgrade to Spring Loaded 1.2.1 as it contains a change that fixes the problem and makes it compatible with Spring Framework 4.1.