This commit is contained in:
wyl
2022-05-29 23:40:19 +08:00
parent 4f99ed9b24
commit 35dbe9f827
6 changed files with 34 additions and 6 deletions
+4 -4
View File
@@ -3,10 +3,10 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.6.7</version>
<relativePath/> <!-- lookup parent from repository -->
<artifactId>spring-boot</artifactId>
<groupId>com.wyl.example</groupId>
<version>1.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<groupId>com.wyl</groupId>
<artifactId>spring-boot-common</artifactId>
@@ -22,7 +22,11 @@ public class LogAspect {
/**
* 以自定义 @WebLog 注解为切点
*/
@Pointcut("@annotation(com.wyl.spring.boot.common.aop.annotation.LogTest)")
// @Pointcut("@annotation(com.wyl.spring.boot.common.aop.annotation.LogTest)")
// public void webLog() {
// }
@Pointcut("execution(* com.wyl.spring.boot.common.service.impl.AopTest.aopLog())")
public void webLog() {
}
@@ -10,4 +10,5 @@ public interface LogTestService {
void testSPEL(Order order);
void testSPELList(List<Order> orders);
}
@@ -0,0 +1,18 @@
package com.wyl.spring.boot.common.service.impl;
import org.aspectj.weaver.ast.Test;
import org.springframework.stereotype.Service;
@Service
public class AopTest {
public void aopLog2()
{
aopLog();
}
public void aopLog()
{
System.out.println(1);
}
}
@@ -11,7 +11,7 @@ import java.util.List;
@Service
public class LogTestServiceImpl implements LogTestService {
@Override
@LogTest
// @LogTest
public void test() {
System.out.println("testLog");
}
@@ -1,6 +1,7 @@
package com.wyl.spring.boot.common;
import com.wyl.spring.boot.common.service.LogTestService;
import com.wyl.spring.boot.common.service.impl.AopTest;
import com.wyl.spring.boot.common.spel.bean.Order;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
@@ -15,8 +16,12 @@ class SpringBootCommonApplicationTests {
@Autowired
LogTestService logTestService;
@Autowired
AopTest aopTest;
@Test
void beanInit() {
aopTest.aopLog2();
}
@Test