0
votes

I am trying to integrate Spring with JSF.

@ManagedBean
@ViewScoped
public class SomeBean() implements Serializable{

    @Autowired
    private SomeService someService;   // with get and set
...
    @PostConstruct
public void init() {
      FacesContextUtils
    .getRequiredWebApplicationContext(FacesContext.getCurrentInstance())
    .getAutowireCapableBeanFactory().autowireBean(this.someService);
}

}

@Service
public class SomeServiceImpl implements SomeService{

    @Autowired
    SomeDao someDao;
...
}

I always get null the someService from bean; it does not inject any value. This is the error that returns us:

javax.servlet.ServletException: JBAS011048: No logró construir la instancia del componente javax.faces.webapp.FacesServlet.service(FacesServlet.java:606).

Can anyone please tell me how to do this properly.Thanks in advance.

we rely on the following Links: Spring JSF integration: how to inject a Spring component/service in JSF managed bean?

@Autowired Spring service not injected in a managed bean

1

1 Answers

-1
votes

Take a look at this post in order to integrate spring with JSF.