中文亚洲精品无码_熟女乱子伦免费_人人超碰人人爱国产_亚洲熟妇女综合网

當前位置: 首頁 > news >正文

微信網(wǎng)站設計價格網(wǎng)站流量分析的指標有哪些

微信網(wǎng)站設計價格,網(wǎng)站流量分析的指標有哪些,如何自制自己的網(wǎng)站,海安網(wǎng)站建設目錄 Spring框架的AOP技術(shù)(注解方式) 通知類型 Spring框架的AOP技術(shù)(注解方式) 1. 步驟一:創(chuàng)建JavaWEB項目,引入具體的開發(fā)的jar包* 先引入Spring框架開發(fā)的基本開發(fā)包com.springsource.org.apache.commo…

目錄

Spring框架的AOP技術(shù)(注解方式)

通知類型


Spring框架的AOP技術(shù)(注解方式)

1. 步驟一:創(chuàng)建JavaWEB項目,引入具體的開發(fā)的jar包* 先引入Spring框架開發(fā)的基本開發(fā)包com.springsource.org.apache.commons.logging-1.1.1.jarcom.springsource.org.apache.log4j-1.2.15.jarspring-beans-5.0.2.RELEASE.jarspring-context-5.0.2.RELEASE.jarspring-core-5.0.2.RELEASE.jarspring-expression-5.0.2.RELEASE.jar* 再引入Spring框架的AOP的開發(fā)包* spring的傳統(tǒng)AOP的開發(fā)的包* spring-aop-5.0.2.RELEASE.jar* com.springsource.org.aopalliance-1.0.0.jar* aspectJ的開發(fā)包* com.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar* spring-aspects-5.0.2.RELEASE.jar*如果是Maven項目,就引入下面的jar包坐標即可<dependency><groupId>org.springframework</groupId><artifactId>spring-context</artifactId><version>5.0.2.RELEASE</version></dependency><dependency><groupId>org.aspectj</groupId><artifactId>aspectjweaver</artifactId><version>1.8.7</version></dependency><dependency><groupId>junit</groupId><artifactId>junit</artifactId><version>4.12</version></dependency><dependency><groupId>org.springframework</groupId><artifactId>spring-test</artifactId><version>5.0.2.RELEASE</version></dependency>
2. 步驟二:創(chuàng)建Spring的配置文件,引入具體的AOP的schema約束<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.xsdhttp://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd"></beans>
?
?
3. 步驟三:創(chuàng)建包結(jié)構(gòu),編寫具體的接口和實現(xiàn)類* org.westos.demo1* CustomerDao           -- 接口* CustomerDaoImpl       -- 實現(xiàn)類
?
4. 步驟四:將目標類配置到Spring中<bean id="customerDao" class="org.westos.demo1.CustomerDaoImpl"/>
?
5. 步驟五:定義切面類* 添加切面和通知的注解* @Aspect -- 定義切面類的注解* 通知類型(注解的參數(shù)是切入點的表達式)* @Before           -- 前置通知* @AfterReturing        -- 后置通知* @Around           -- 環(huán)繞通知* @After            -- 最終通知* @AfterThrowing        -- 異常拋出通知* 具體的代碼如下@Aspectpublic class MyAspectAnno {@Before(value="execution(public void org.westos.demo1.CustomerDaoImpl.save())")public void log(){System.out.println("記錄日志...");}}
?
6. 步驟六:在配置文件中定義切面類<bean id="myAspectAnno" class="org.westos.demo1.MyAspectAnno"/>
?
7. 步驟七:在配置文件中開啟自動代理<aop:aspectj-autoproxy/> 放在最前面
?
8. 完成測試@RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration("classpath:applicationContext.xml")public class Demo1 {@Resource(name="customerDao")private CustomerDao customerDao;@Testpublic void run1(){customerDao.save();customerDao.update();}}

通知類型

1. 通知類型* @Before           -- 前置通知* @AfterReturing    -- 后置通知* @Around           -- 環(huán)繞通知(目標對象方法默認不執(zhí)行的,需要手動執(zhí)行)* @After            -- 最終通知* @AfterThrowing    -- 異常拋出通知
?
2. 配置通用的切入點* 使用@Pointcut定義通用的切入點@Aspectpublic class MyAspectAnno {//隨便定義一個方法,上面用注解定義一個切入點@Pointcut(value="execution(public void org.westos.demo1.CustomerDaoImpl.save())")public void fn(){}//引用這個定義的切入點 格式:切面類名.方法名@Before(value="MyAspectAnno.fn()")public void log(){System.out.println("記錄日志...");}

        /*** 環(huán)繞通知*/@Around(value="MyAspectAnno.fn()")public void around(ProceedingJoinPoint joinPoint){System.out.println("環(huán)繞通知1...");try {// 讓目標對象的方法執(zhí)行joinPoint.proceed();} catch (Throwable e) {e.printStackTrace();}System.out.println("環(huán)繞通知2...");}}

http://www.risenshineclean.com/news/55196.html

相關文章:

  • 比特幣做空網(wǎng)站廣州seo網(wǎng)絡推廣員
  • 日本男女做受網(wǎng)站怎么建造自己的網(wǎng)站
  • 公司做網(wǎng)站 優(yōu)幫云新軟件推廣
  • 網(wǎng)站頁面設計欣賞模板競價托管資訊
  • 做網(wǎng)站 服務器多少錢一年網(wǎng)絡營銷課程設計
  • 國內(nèi)做外貿(mào)如何訪問外國網(wǎng)站站長之家權(quán)重
  • 網(wǎng)絡網(wǎng)站制作技巧工業(yè)設計公司
  • 西部數(shù)碼備案域名購買seo培訓教程視頻
  • 買賣域名掙幾十萬標題優(yōu)化seo
  • 廣東網(wǎng)站設計費用網(wǎng)絡推廣的渠道有哪些
  • 建網(wǎng)站一般最低多少錢什么是網(wǎng)絡推廣營銷
  • 濰坊做網(wǎng)站哪家公司最好搜索引擎營銷包括
  • 用什么工具做網(wǎng)站視圖營銷策略ppt模板
  • php asp網(wǎng)站開發(fā)站長之家seo一點詢
  • 免費建立網(wǎng)站空間資源搜索神器
  • 蘇州h5模板建站seo網(wǎng)站優(yōu)化快速排名軟件
  • 虛擬網(wǎng)站服務器關鍵詞歌詞林俊杰
  • 專門做dm單的網(wǎng)站互聯(lián)網(wǎng)營銷師培訓課程
  • 重慶網(wǎng)站建設velpai營銷管理
  • 求網(wǎng)頁設計與網(wǎng)站建設我為什么不建議年輕人做運營
  • 廣州網(wǎng)站模板建站關鍵詞研究工具
  • 個人網(wǎng)站可以做咨詢嗎seo面試常見問題及答案
  • 做番號網(wǎng)站的 違法磁力鏈最好用的搜索引擎
  • 開發(fā)一個網(wǎng)站 要多久電商運營自學全套教程
  • 開發(fā)網(wǎng)站監(jiān)控推薦營銷推廣外包
  • 資中做網(wǎng)站多少錢新聞聯(lián)播今日新聞
  • 旅游網(wǎng)站怎么做的seo快排公司哪家好
  • 煙臺做網(wǎng)站的企業(yè)怎樣建網(wǎng)站
  • 江蘇網(wǎng)站建設空間環(huán)球網(wǎng)最新消息
  • 公司網(wǎng)站建設方案匯報營銷方案模板