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          <!--启用注解所需要添加到schemaLocation-->
        https://www.springframework.org/schema/context/spring-context.xsd"    <!--启用注解所需要添加到schemaLocation-->
        default-autowire="constructor">
        <context:annotation-config/>  <!--启用注解-->
</beans>

 

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

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

 

posted @ 2022-03-01 11:53  binbin_cloud  阅读(122)  评论(0编辑  收藏  举报