I have a question regarding class declarations in applicationContext.xml
In applicationContext.xml do we need to specify all classes from the application? For instance. In my small web application, I have an Entity class, a Service class, and a DAO class. Therefore, it is currently defined as
<bean id="Employees" class="net.test.model.Employees" /> <bean id=" EmployeeService" class="net.test.employees.service.EmployeeService"> <property name="employeesDAO" ref="EmployeeDAOImpl" /> </bean> <bean id="EmployeeDAO" class="net.test.employee.dao.EmployeeDAOImpl"> <property name="sessionFactory" ref="SessionFactory" /> </bean>
So, if I have several classes of objects, services and Tao, do I need to specify all these classes in applicationContext.xml ?
Any understanding of this is very noticeable.
Hello
Update 1
Managedbean
@ManagedBean(name="empMB") @Named @Scope("request") public class EmployeesManagedBean implements Serializable {
and I have an Inject annotation
@Inject EmployeesService employeesService;
In EmployeesService I have annotations like
@Named public class EmployeesService implements IEmployeesService { @Inject EmployeesDAO employeesDAO; @Override public List<Employees> getEmployees() { return getEmployeesDAO().getEmployees(); }
and finally in applicationContext.xml I have
<context:component-scan base-package="net.test" />
Now the problem is that when I run my application, I get
java.lang.NullPointerException at net.test.managed.bean.EmployeesManagedBean.getEmpList(EmployeesManagedBean.java:53)
What am I doing wrong to get a nullpointer exception ?