【Spring】Spring入门(七)注解实现自动装配

在这里插入图片描述
要使用注解须知:
1、导入约束 context约束
2、配置注解的支持


<beans xmlns="http://www.springframework.org/schema/beans"
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
     xmlns:context="http://www.springframework.org/schema/context"
     xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/context
         http://www.springframework.org/schema/context/spring-context.xsd">

   <context:annotation-config/>

beans>

【Spring】Spring入门(七)注解实现自动装配_第1张图片
【Spring】Spring入门(七)注解实现自动装配_第2张图片
【Spring】Spring入门(七)注解实现自动装配_第3张图片
【Spring】Spring入门(七)注解实现自动装配_第4张图片
【Spring】Spring入门(七)注解实现自动装配_第5张图片
【Spring】Spring入门(七)注解实现自动装配_第6张图片

你可能感兴趣的:(Spring)