配置扫描注解的包

Posted liuyang-520

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了配置扫描注解的包相关的知识,希望对你有一定的参考价值。

配置文件:

<?xml version="1.0" encoding="UTF-8"?>
<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:component-scan base-package="com.ly.spring"></context:component-scan>
</beans>

 

以上是关于配置扫描注解的包的主要内容,如果未能解决你的问题,请参考以下文章

基于注解配置扫描包

spring学习3:spring ioc的纯注解配置

spring的注解使用

基于注解的 AOP 配置

[1]Java开发实习面试打卡

[1]Java开发实习面试打卡