我有界面
public interface ServiceImpl {
public List<?> getAll();
}
并有豆类
public class MessageService implements ServiceImpl{
@Autowired
private SessionFactory sessionFactory;
@Override
public List<MessageItem> getAll() {
List<MessageItem> lst = sessionFactory.getCurrentSession().createQuery("from MessageItem c").list();
return lst;
}
}
没有创建 Bean....
豆定义
<bean id="messageService" class="ru.apusvao.phone.model.MessageService"/>
例外
org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [ru.apusvao.phone.model.MessageService] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}