一.在applicationContext.xml配置中指定要扫描的包 <context:component-scan base-package="com.lg"/> 二:创建PersonDao类并添加注解 dao层的类使用@Repository注解 @Repository public class PersonDao { public Person find(Person p) { if("lglg".equals(p.getUsername()