JSF 2 converters and Spring services

Updated:

Problem:

I’ve a JavaServer Faces 2 converter (@FacesConverter) and I’ve to access a Spring service. The converter is managed by jsf and if I use @Service or a Spring bean I’ve a null pointer exception

Solution:

access the Spring service using FacesContextUtils. Ex:

@Override 
public Object getAsObject(FacesContext facesContext, UIComponent uiComponent, String s) { 
... 
  if (personneService == null) { 
          personneService = (PersonneService) FacesContextUtils.getWebApplicationContext(facesContext).getBean("personneService"); 
   ... 
   } 

Fullstack Angular / Java application quick start guide.
WebApp built by Marco using SpringBoot 3.2.4 and Java 21. Hosted in Switzerland (GE8).