PF4J Spring - not able to load any components in the plugin other than the beans declared in configuration class

576 views Asked by At

We are using plugin architecture for one of our projects and we decided to use Spring pf4j for the same. When we load the plugin via extensions - the application context is not able to find the beans created using @component in the plugin project- but the beans declared in @configuration classes are injected properly when we configure the plugin using register method - Is there anyway to scan and load the spring components in the plugin?

1

There are 1 answers

0
Hank On

@Component in plugin is registered to main ApplicationContext via SpringExtensionFactory, make sure you set it up correctly in DefaultPluginManager correctly.

If you are going to use pf4j in SpringBoot, I would suggest you take a look sbp project. It is built upon pf4j and provides better integration with SpringBoot.