spring--启用注解功能


<beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:p="http://www.springframework.org/schema/p" 
        xmlns:c="http://www.springframework.org/schema/c"
       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          
        https://www.springframework.org/schema/context/spring-context.xsd"    
        default-autowire="constructor">
        <context:annotation-config/>  
beans>

在所在使用注解的类import导入注解包

import org.springframework.beans.factory.annotation.*;