1. 程式人生 > >Spring框架中的aop操作 及aspectjweaver.jar與aopalliance-1.0.jar下載地址 包含beans 註解context 和aop的約束

Spring框架中的aop操作 及aspectjweaver.jar與aopalliance-1.0.jar下載地址 包含beans 註解context 和aop的約束

包括 aspect component cts base aid 核心 lease express

(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)

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


然後在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>

Spring框架中的aop操作 及aspectjweaver.jar與aopalliance-1.0.jar下載地址 包含beans 註解context 和aop的約束