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
@@ -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