[英]How can I inject dependencies into a javax.faces.context.ExceptionHandler using Spring?
I have a JSF application using PrimeFaces 6.2 and Spring 5.1.4. 我有一个使用PrimeFaces 6.2和Spring 5.1.4的JSF应用程序。 I read, that an exception handler can be defined in the faces-config.xml
like this: 我读到,可以在faces-config.xml
定义一个异常处理程序,如下所示:
<factory>
<exception-handler-factory>my.package.MyExceptionHandlerFactory</exception-handler-factory>
</factory>
I wondered how I could get the dependencies injected into an ExceptionHandlerFactory
and ExceptionHandler
? 我想知道如何将依赖项注入到ExceptionHandlerFactory
和ExceptionHandler
?
You can't do this out of the box. 您不能开箱即用。 It would be possible by creating an "spring aware" ExceptionHandlerFactory and create the ExceptionHandler instance via Spring but i would just get the beans manually in your ExceptionHandler like: Best way to manually pull a spring bean? 通过创建“弹簧感知”的ExceptionHandlerFactory并通过Spring创建ExceptionHandler实例,这是可能的,但是我只是在ExceptionHandler中手动获取Bean,如: 手动拉动Spring Bean的最佳方法?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.