1、根据类获取对象
@Autowired
ApplicationContext context; GenericMapper<T,String> dao=(GenericMapper<T,String>)context.getBean(TestDaoImpl.class);
2、根据接口获取实现类的对象
@Autowired
ApplicationContext context; GenericMapper<T,String> dao=(GenericMapper<T,String>)context.getBean(TestInterface.class);