я использовал,EJB и CDI инъекционные точки в @FacesValidator и @FacesConverter не в состоянии работать с помощью OmniFaces новых версий JSF
- Mojarra 2.3.0-M01
- OmniFaces 2.0.
- PrimeFaces 5,1 окончательный
- PrimeFaces Extension 3.0.0
- GlassFish Сервер 4,1
и другие артефакты Java EE.
Инъекции точки в @FacesValidator
вроде как следует,
@FacesValidator(value="testValidator")
public class TestValidator implements Validator {
@Inject
private DemoEJB ejb;
@Inject
private ManagedBean managedBean;
@Override
public void validate(FacesContext context, UIComponent component, Object value) throws ValidatorException {
// Use the injected EJB and/or managed bean here.
}
}
Эти точки инъекции остаются null
(я явно не попробовать нагнетание EJB, но это не должно происходить так же, как управляемый компонент).
Поскольку вышеупомянутый версия Mojarra все еще доступен как снимок, я попытался понижая его 2.2.10 с той же версией OmniFaces, которая является 2,0 (альтернативно, также пытались с OmniFaces 2.1-SNAPSHOT - на обоих Mojarra 2.2.10 и 2.3.0-m01), но безрезультатно.
Это сработало, когда я понизил Majarra до 2.2.8-02 (попробовал с OmniFaces 1.8.1, 2.0 и 2.1-SNAPSHOT в качестве альтернативы). Я не пробовал другие версии Моджарры.
была поддержка, чтобы сделать @FacesValidator
и @FacesConverter
кандидатов на EJB и точек впрыска CDI с помощью OmniFaces (который, в свою очередь, не требует каких-либо зависимостей сложения и/или конфигурации) удалены для новых версий Mojarra?
я еще не явно пытался в @FacesConverter
только потому, что изменение этого много библиотек в качестве альтернативы так много раз, используя IDE NetBeans багги, который также идет очень медленно на Windows, по своей природе взял весь день от рассвета до заката.
EDIT:
Сервер производит следующие Сварные связанные предупреждения.
WARN: WELD-001700: Interceptor annotation class javax.ejb.PostActivate not found, interception based on it is not enabled
WARN: WELD-001700: Interceptor annotation class javax.ejb.PrePassivate not found, interception based on it is not enabled
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.gf.cdi.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] public org.omnifaces.VetoAnnotatedTypeExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.gf.cdi.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.gf.cdi.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] public org.omnifaces.VetoAnnotatedTypeExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] public org.glassfish.jms.injection.JMSCDIExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] org.glassfish.sse.impl.ServerSentEventCdiExtension.processAnnotatedType(@Observes ProcessAnnotatedType<Object>, BeanManager) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-000411: Observer method [BackedAnnotatedMethod] private org.glassfish.jersey.gf.cdi.internal.CdiComponentProvider.processAnnotatedType(@Observes ProcessAnnotatedType<Object>) receives events for all annotated types. Consider restricting events using @WithAnnotations or a generic type with bounds.
WARN: WELD-001473: javax.enterprise.inject.spi.Bean implementation [email protected] declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with a passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.
WARN: WELD-001473: javax.enterprise.inject.spi.Bean implementation [email protected] declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with a passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.
WARN: WELD-001473: javax.enterprise.inject.spi.Bean implementation [email protected] declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with a passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.
WARN: WELD-001473: javax.enterprise.inject.spi.Bean implementation [email protected] declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with a passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.
WARN: WELD-001473: javax.enterprise.inject.spi.Bean implementation [email protected] declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with a passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.
WARN: WELD-001473: javax.enterprise.inject.spi.Bean implementation [email protected] declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with a passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.
Работает для меня на Tomcat 8.0.18 + Mojarra 2.3.0-m01 (и 2.2.10) + Weld 2.2.9. У меня сейчас нет GF4.1, но с какой версией Weld он поставляется? – BalusC
Версия Weld в GlassFish 4.1 является 2.2.2, как указано [здесь] (https://blogs.oracle.com/theaquarium/entry/spotlight_on_glassfish_4_16) и [здесь] (http://nofluffjuststuff.com/blog/reza_rahman/ 2014/09/spotlight_on_glassfish_4_1__9_components_versions). Несмотря на то, что я не знаю, есть ли способ получить этот номер версии программно. GlassFish 4.1 выпускает некоторые предупреждения, связанные с Weld. Я приложил их к вопросу. – Tiny
Версия для сварки зарегистрирована как 'INFO: WELD-000900'. Я понизил его до 2.2.2 для Tomcat, но все равно не могу воспроизвести его. Должен попробовать GF 4.1 позже. Эти предупреждения маловероятны. – BalusC