You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Solution: specify class in plugin.pluginFirstClasses of application.yml
It's because the class is loaded by mismatch class loader. spring-boot-autoconfigure
package referred a lot 3rd party classed directly, which should be loaded
by our PluginClassloader in our case.
Irrelevant beans get inject to plugin ApplicationContext
You need to find out which AutoConfiguration introduce those
beans, and add it by getExcluceConfigurations.
If you try to run your app with plugin from IDE, mostly the IDE will only
compile the app project/module only. Therefore you have to tell the
IDE compile everything including plugin code. for IDEA, you could use this
setting of Run/Debug Configuration:
Autowire PluginManager carefully
Since plugin injects beans from main app, you'd better always use @Lazy
with @Autowire for PluginManager together to make sure Spring instantiates
all needed beans before it starts to load plugin.
Misc.
Package name cannot start with org.pf4j, java or javax.
PluginClassLoader will treat them differently.
Stay in same framework stack as long as you can. Introducing library with complex
dependencies (link Spring Data JPA) into plugin only, will cause many unexpected
problems. Because plugin and app have different classloader, it's a little
bit hard to mark sure all referred dependent classes are loaded by the same
classloader.