我用ssh搭建了一个项目,
表和对象的映射是通过注解的方式映射的
我在applicationContext.xml中配置了下面这个Bean
<bean id="staffService" class="com.test.staffServiceImpl"></bean>
我现在想在想写个main方法,在main方法中获取staffService这个Bean,并调用这个Bean对象的getStaff方法
我在main方法中这么写的
执行main方法的时候,获取到了staffService 这个bean对象,但执行getStaff方法时提示找不到Staff这个Entity,请问该如何调用这个方法呢?
我在applicationContext.xml中配置了下面这个Bean
<bean id="staffService" class="com.test.staffServiceImpl"></bean>
我现在想在想写个main方法,在main方法中获取staffService这个Bean,并调用这个Bean对象的getStaff方法
我在main方法中这么写的
public static void main(String[] args){
ApplicationContext ac = new ClassPathXmlApplicationContext("applicationContext.xml");
BeanFactory bf = (BeanFactory)ac;
StaffService staffService = (StaffService)bf.getBean(staffService);
staffService.getStaff("00000000");
}
执行main方法的时候,获取到了staffService 这个bean对象,但执行getStaff方法时提示找不到Staff这个Entity,请问该如何调用这个方法呢?