有时候报的错误让你匪夷所思,找错误得学会找根.源头在哪里? 比如:我们刚开始看的错误就是 org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'userInfoServiceImpl': Unsatisfied dependency expressed through field 'userInfoRepository'; nested exception
1.@Component:把普通pojo实例化到spring容器中,相当于配置文件中的<bean id="" class=""/> 2.@Autowired:Spring框架中进行对象注入 @Component public class Person { private String id; private String name; private String sex; //getter/setter省略 } @Service public class
1.代码结构图 xxx 2.bean代码 package com.xxx.bean; /** * Created with IntelliJ IDEA. * User: zhenwei.liu * Date: 13-7-18 * Time: 上午1:25 * To change this template use File | Settings | File Templates. */ public abstract class People { protected String name; p