0

I want to ask to the expert over here which one is a better approach for injecting Spring bean inside of a JSF Managed Bean.

I have gone through many tutorials on this topic and there are 2 ways to achieve this.

1)By extending SpringBeanAutowiringSupport class

2)By registering SpringBeanFacesELResolver class in faces-config.xml file.

But option 2 is not working in case of an ADF Application.I am unable to figure out the reason.I have registered the SpringBeanFacesELResolver in faces-config.xml file but whether it has to be define in adfc-config.xml file I am not sure.

So,I have gone with Option 1. So,I want to know is there any drawback of this approach?

Whether any extra configuration needed to make SpringBeanFacesELResolver worked for ADF application?

Aritz
  • 30,971
  • 16
  • 136
  • 217
Sumit Ghosh
  • 484
  • 4
  • 13
  • 36
  • Maybe switching to CDI annotations is an option? – Kukeltje Jun 13 '18 at 11:27
  • I don't think ADF is supporting cdi annotations it still uses managed bean concept. CDI concept came to jsf with JSF2.3,in ADF it is using JSF2.1. – Sumit Ghosh Jun 13 '18 at 12:23
  • I've been using CDI with JSF since jsf version late 2.1.x... In 2.3 the `@ManagedBean` annotations also still work but are now officially deprecated. It is more container related than ADF related – Kukeltje Jun 13 '18 at 12:58
  • I have JSF working with spring: https://stackoverflow.com/questions/46187725/spring-boot-jsf-integration You shouldn't need to change `adfc-config`. How do you know the issue is ADF related? Do you have any trace/exception? Have you tried with any ADFless JSF application? – Aritz Jun 14 '18 at 14:26

0 Answers0