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
vaadin/spring#193 added support for Vaadin Spring to create components in a design as Spring beans. The same thing would be needed for CDI so you can inject the application components instead of always creating them using new MyComponent
The text was updated successfully, but these errors were encountered:
This seems to work but I hope there is a better way:
Design.setComponentFactory(new DefaultComponentFactory() {
@Override
public Component createComponent(String fullyQualifiedClassName, DesignContext context) {
Class<? extends Component> componentClass = resolveComponentClass(fullyQualifiedClassName, context);
Instance<? extends Component> managedComponent = CDI.current().select(componentClass);
if (!managedComponent.isAmbiguous() && !managedComponent.isUnsatisfied()) {
// Injectable, still not clear if the correct class will be
// used (e.g. componentClass might be Grid<Foo> and
// MyOwnGrid might be injected, if that happens to exist in
// the project
Component component = managedComponent.get();
if (component.getClass() == componentClass) {
return component;
}
}
return super.createComponent(fullyQualifiedClassName, context);
}
});
vaadin/spring#193 added support for Vaadin Spring to create components in a design as Spring beans. The same thing would be needed for CDI so you can inject the application components instead of always creating them using
new MyComponent
The text was updated successfully, but these errors were encountered: