目标
-
以
Spring+SpringMVC
框架为基础,实现基于AOC
方式的统计运行时间
功能 -
基于
SpringMVC
完成AOC
应用,有两种方式:- 基于
XML
配置文件方式 - 基于
注解
方式
在本文中使用
注解
方式完成AOC
应用 - 基于
过程
创建工程项目
-
在
IntelliJ
中新建一个Empty Project
,作为基础项目空间 -
在新建的
Empty Project
中新建一个Spring
项目,在右边的Additional Libraries and Frameworks
选项框中勾选Spring MVC
至此,工程项目创建完成
pom.xml
配置文件
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>aop-print-runtime</artifactId>
<version>1.0-SNAPSHOT</version>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>6</source>
<target>6</target>
</configuration>
</plugin>
</plugins>
</build>