i want to test the spring bean's injection into jsf managed bean by passing a prefilled list , it's giving me nullpointer exception .. the jsf is rendered and showing no records found ...
JSF page :
<p:dataTable value="#{testController.list}" var="type">
<p:column headerText="Lib">
<h:outputText value="#{type}">
</h:outputText>
</p:column>
</p:dataTable>
JSF bean :
@ManagedBean
@SessionScoped
public class TestController {
@ManagedProperty(value = "#{documentService}")
DocumentService documentService;
private List<String> list = new ArrayList<String>();
public List<Rhnom> getList() {
try {
list = documentService.getTypesDocuments();
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return list;
} //setter
Spring Service :
@Service
public class DocumentServiceImpl implements DocumentService {
@SuppressWarnings("serial")
@Override
public List<String> getStaticList (){
List<String> list2 = new ArrayList<String>() {{
add("s1");
add("s2");
add("s3");
}};
return list2;
}
Faces config :
org.springframework.web.jsf.el.SpringBeanFacesELResolver