-
Notifications
You must be signed in to change notification settings - Fork 105
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
Handle Scope annotation on extension class #6
base: master
Are you sure you want to change the base?
Conversation
From log:
|
I see a problem when we try to add scope on @Extension(ordinal=1)
@Scope("prototype")
public static class HelloGreeting implements Greeting {
@Autowired
private MessageProvider messageProvider;
@Override
public String getGreeting() {
// return "Hello";
// complicate a little bit the code
return messageProvider.getMessage();
}
} The exception is:
The idea is that Of course we can something like: if (plugin.getPlugin() instanceof SpringPlugin) {
ApplicationContext pluginContext = ((SpringPlugin) plugin.getPlugin()).getApplicationContext();
beanDefinitionRegistry = (BeanDefinitionRegistry) pluginContext.getAutowireCapableBeanFactory();
}
registerExtension(extensionFactory.create(extensionClass), beanDefinitionRegistry); in Now, when we use register as singleton, the problem discussed above doesn't appear. It's clear that we can play with an application context hierarchy in Spring but I don't know how. The context child can see the beans from context parent but the context parent doesn't see the beans from the context child. |
This is useful, release it please~ |
@goto100 |
No description provided.