I'm trying to combine CDI (weld-se 2) and JavaFX and I want to annotate my controller class with custom created annotation so this class creation is managed using my factory method. I suppose that is should looks like below but this code is not working. Could you possibly advice what should be changed?
Annotation:
@Retention(RetentionPolicy.RUNTIME)
@Target({ ElementType.FIELD, ElementType.METHOD, ElementType.PARAMETER, ElementType.TYPE })
@Qualifier
public @interface FXMLManaged {
}
Factory class:
public class FXMLManagedProducer {
@Produces @FXMLManaged
public <T> T getFXMLManagedInstance(Class<T> type) {
return type.newInstance();
}
}
Controller class:
@FXMLManaged
public class NewsListView {
}