properly bind ClassSet extensions as singletons
The ExtensionPoint.ClassSet binds adds the extension classes to a a Multibinder and binds the classes and calls the asEagerSingleton method on the multibinder. This does not actually create a singleton. Instead we first bind the class as a singleton and add then add the class to the multibinder. Closes #14194
This commit is contained in:
parent
75cedca0da
commit
ec4307f080
|
@ -191,7 +191,8 @@ public abstract class ExtensionPoint {
|
||||||
protected final void bindExtensions(Binder binder) {
|
protected final void bindExtensions(Binder binder) {
|
||||||
Multibinder<T> allocationMultibinder = Multibinder.newSetBinder(binder, extensionClass);
|
Multibinder<T> allocationMultibinder = Multibinder.newSetBinder(binder, extensionClass);
|
||||||
for (Class<? extends T> clazz : extensions) {
|
for (Class<? extends T> clazz : extensions) {
|
||||||
allocationMultibinder.addBinding().to(clazz).asEagerSingleton();
|
binder.bind(clazz).asEagerSingleton();
|
||||||
|
allocationMultibinder.addBinding().to(clazz);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue