Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I use it SpringPluginManager, It seems to be a single case. #61

Open
799452017 opened this issue Jan 4, 2021 · 4 comments
Open

I use it SpringPluginManager, It seems to be a single case. #61

799452017 opened this issue Jan 4, 2021 · 4 comments

Comments

@799452017
Copy link

SpringPluginManager pluginManager = new SpringPluginManager(new File("plugins").toPath());
DemoImpl implA = pluginManager.getExtension(DemoImpl.class,"xxxx").get(0);
implA.setMessage("hello");

DemoImpl impB = pluginManager.getExtension(DemoImpl.class,"xxxx").get(0);
String message = implB.getMessage(); // I want an unassigned message

SpringExtensionFactory is written in extensionClass.newInstance(), But after the experiment, the message I get is still hello.I have no idea.

@799452017
Copy link
Author

@decebals Can you give me an answer? Please, my project is in serious trouble now.

@decebals
Copy link
Member

decebals commented Jan 11, 2021

As I said, pf4j-spring is very light and can be analyzed, debugging or recreated very easy.
I don't use spring in my projects involving PF4J, so my knowledge of this combo (spring-pf4j) is limited.

But if I'll encounter your problem I will try to take a look in SpringExtensionFactory#create method.

Following the flow of the code source, I will investigate SpringExtensionFactory#createWithSpring. I will put some breakpoints in this method (createWithSpring) and I will put the log level on TRACE to retrieve more information.
In the end I will take a look on AutowireCapableBeanFactory#createBean (implementation) to see how the bean is created concretely (as singleton, prototype, ...) and I will search on the internet if it's a chance to change the current behavior.

@799452017
Copy link
Author

正如我所说,pf4j-spring它非常轻便,可以很容易地进行分析,调试或重新创建。
我在涉及PF4J的项目中没有使用spring,因此我对该组合(spring-pf4j)的了解有限。

但是我遇到您的问题,我将尝试看一下SpringExtensionFactory#create方法。

按照代码源的流程,我将研究SpringExtensionFactory#createWithSpring。我将在此方法(createWithSpring)中放置一些断点,并放置日志级别TRACE以检索更多信息。
最后,我将看一下AutowireCapableBeanFactory#createBean(实现),以了解如何具体创建该bean(如单例,原型等),如果有机会更改当前行为,我将在Internet上进行搜索。

Thank you very much. I use pf4j-srping:0.7.0 .

@decebals
Copy link
Member

@799452017 Any update here?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants