import org.aspectj.lang.annotation.Aspect; import org.aspectj.lang.annotation.Before; @Aspect public class LoggingAspect { @Before("execution(* com.example.service.*.*(..))") public void beforeAdvice() { } } <dependencies> <dependency> <groupId>org.aspectj</groupId> <artifactId>aspectjrt</artifactId> <version>1.9.7</version> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.aspectj</groupId> <artifactId>aspectj-maven-plugin</artifactId> <version>1.12.6</version> <configuration> <source>1.8</source> <target>1.8</target> <complianceLevel>1.8</complianceLevel> <Xlint>ignore</Xlint> <showWeaveInfo>true</showWeaveInfo> <verbose>true</verbose> <aspectLibraries> <aspectLibrary> <groupId>com.example</groupId> <artifactId>my-aspect-library</artifactId> </aspectLibrary> </aspectLibraries> </configuration> <executions> <execution> <goals> <goal>compile</goal> <goal>test-compile</goal> </goals> </execution> </executions> </plugin> </plugins> </build>


上一篇:
下一篇:
切换中文