5.1配置applicationContext.xml

5.2给对应bean加注解

Annotation
        @Autowired,Resource 自动装配依赖,默认是按照类型来装配
@Resource(name="userDao"),自动按照名字来装配
@Scope("prototype") 

@Repository:dao层
@Service:service层
@Controller:web层