[Solved] ClassNotFoundException for ReflectUtils when making a plugin using Spring Java Config

My organisation has a Confluence Data Center v8.9 installation that I’m trying to write a plugin for. I’m mainly a Spring developer so I’m trying to use Spring Java Config as a base for the plugin, however when it deploys I get the error

[INFO] [talledLocalContainer] Caused by: java.lang.NoClassDefFoundError: org/springframework/cglib/core/ReflectUtils
[INFO] [talledLocalContainer]   at my.plugin.SpringConfig$$EnhancerBySpringCGLIB$$b0fa2ecc.CGLIB$STATICHOOK265(<generated>)
[INFO] [talledLocalContainer]   at my.plugin.SpringConfig$$EnhancerBySpringCGLIB$$b0fa2ecc.<clinit>(<generated>)
[INFO] [talledLocalContainer]   at java.base/java.lang.Class.forName0(Native Method)
[INFO] [talledLocalContainer]   at java.base/java.lang.Class.forName(Class.java:467)
[INFO] [talledLocalContainer]   at org.springframework.cglib.core.ReflectUtils.defineClass(ReflectUtils.java:604)
[INFO] [talledLocalContainer]   at org.springframework.cglib.core.AbstractClassGenerator.generate(AbstractClassGenerator.java:363)
[INFO] [talledLocalContainer]   at org.springframework.cglib.proxy.Enhancer.generate(Enhancer.java:585)
[INFO] [talledLocalContainer]   at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:110)
[INFO] [talledLocalContainer]   at org.springframework.cglib.core.AbstractClassGenerator$ClassLoaderData$3.apply(AbstractClassGenerator.java:108)
[INFO] [talledLocalContainer]   at org.springframework.cglib.core.internal.LoadingCache$2.call(LoadingCache.java:54)
[INFO] [talledLocalContainer]   at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
[INFO] [talledLocalContainer]   at org.springframework.cglib.core.internal.LoadingCache.createEntry(LoadingCache.java:61)
[INFO] [talledLocalContainer]   ... 22 more
[INFO] [talledLocalContainer] Caused by: java.lang.ClassNotFoundException: org.springframework.cglib.core.ReflectUtils not found by my.plugin [317]
[INFO] [talledLocalContainer]   at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1591)
[INFO] [talledLocalContainer]   at org.apache.felix.framework.BundleWiringImpl.access$300(BundleWiringImpl.java:79)
[INFO] [talledLocalContainer]   at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:1976)
[INFO] [talledLocalContainer]   at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
[INFO] [talledLocalContainer]   ... 34 more

at the bottom of a stack trace in my locally running Confluence.

I have imported the Spring libraries in the POM as shown in the documentation:

    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-beans</artifactId>
      <version>6.1.6</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>org.springframework</groupId>
      <artifactId>spring-context</artifactId>
      <version>6.1.6</version>
      <scope>provided</scope>
    </dependency>
    <dependency>
      <groupId>com.atlassian.plugins</groupId>
      <artifactId>atlassian-plugins-osgi-javaconfig</artifactId>
      <version>0.6.0</version>
    </dependency>

And I’ve set up the Spring XML:

  <context:annotation-config />
  <bean class="my.plugin.SpringConfig" />

Where should I look to debug this?

Solved. Turned out I just needed to clear out the target/ directory and re-start the Confluence instance, then it started working.