Spring框架中的aop操作之一 及aspectjweaver.jar与aopalliance-1.0.jar下载地址 包含beans 注解context 和aop的约束

旧时模样 提交于 2020-03-30 21:13:16

(aspect oriented programming面向切面编程)

首先在原有的jar包:

需Spring压缩包中的四个核心JAR包

beans 、context、core 和expression

下载地址:

https://pan.baidu.com/s/1qXLHzAW

以及日志jar包

commons-logging 和log4j

下载地址:

https://pan.baidu.com/s/1mimTW5i

再增加一个

spring-aop-5.0.1.RELEASE.jar (用于注解,在Spring-framework库中包含)

再增加

spring-aspects-5.0.1.RELEASE.jar (在Spring-framework库中包含)

aspectjweaver-1.8.12.jar (官方下载地址 http://mvnrepository.com/artifact/org.aspectj/aspectjweaver)

spring收购的aspectj的一部分包只关于weaver的

aopalliance-1.0.jar            (官方下载地址 http://mvnrepository.com/artifact/aopalliance/aopalliance/1.0)

上边是aop联盟的包

 


 

然后在Spring-framework库中docs文件夹中找到html文件夹的xsd-configuration.html文件

找到aop的相关约束。(不包含注解的约束)

<?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:aop="http://www.springframework.org/schema/aop" xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
        http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"> <!-- bean definitions here -->

</beans>

之前的注解context的约束(包括了下边的beans的约束)

<?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"> <!-- bean definitions here -->

</beans>

之前的beans的约束

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="
        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">

    <bean id="foo" class="x.y.Foo">
        <property name="name" value="Rick"/>
    </bean>

</beans>

包含beans 注解context 和aop的约束

<?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"
    xmlns:aop="http://www.springframework.org/schema/aop"
    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
         http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd">
    <!-- 开启注解扫描 -->
    <context:component-scan base-package="com.swift"></context:component-scan>
</beans>

 

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!