test
This commit is contained in:
@@ -3,10 +3,10 @@
|
|||||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
|
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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
<parent>
|
<parent>
|
||||||
<groupId>org.springframework.boot</groupId>
|
<artifactId>spring-boot</artifactId>
|
||||||
<artifactId>spring-boot-starter-parent</artifactId>
|
<groupId>com.wyl.example</groupId>
|
||||||
<version>2.6.7</version>
|
<version>1.0-SNAPSHOT</version>
|
||||||
<relativePath/> <!-- lookup parent from repository -->
|
<relativePath>../pom.xml</relativePath>
|
||||||
</parent>
|
</parent>
|
||||||
<groupId>com.wyl</groupId>
|
<groupId>com.wyl</groupId>
|
||||||
<artifactId>spring-boot-common</artifactId>
|
<artifactId>spring-boot-common</artifactId>
|
||||||
|
|||||||
+5
-1
@@ -22,7 +22,11 @@ public class LogAspect {
|
|||||||
/**
|
/**
|
||||||
* 以自定义 @WebLog 注解为切点
|
* 以自定义 @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() {
|
public void webLog() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+1
@@ -10,4 +10,5 @@ public interface LogTestService {
|
|||||||
void testSPEL(Order order);
|
void testSPEL(Order order);
|
||||||
|
|
||||||
void testSPELList(List<Order> orders);
|
void testSPELList(List<Order> orders);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+18
@@ -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);
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -11,7 +11,7 @@ import java.util.List;
|
|||||||
@Service
|
@Service
|
||||||
public class LogTestServiceImpl implements LogTestService {
|
public class LogTestServiceImpl implements LogTestService {
|
||||||
@Override
|
@Override
|
||||||
@LogTest
|
// @LogTest
|
||||||
public void test() {
|
public void test() {
|
||||||
System.out.println("testLog");
|
System.out.println("testLog");
|
||||||
}
|
}
|
||||||
|
|||||||
+5
@@ -1,6 +1,7 @@
|
|||||||
package com.wyl.spring.boot.common;
|
package com.wyl.spring.boot.common;
|
||||||
|
|
||||||
import com.wyl.spring.boot.common.service.LogTestService;
|
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 com.wyl.spring.boot.common.spel.bean.Order;
|
||||||
import org.junit.jupiter.api.Test;
|
import org.junit.jupiter.api.Test;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
@@ -15,8 +16,12 @@ class SpringBootCommonApplicationTests {
|
|||||||
@Autowired
|
@Autowired
|
||||||
LogTestService logTestService;
|
LogTestService logTestService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
AopTest aopTest;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void beanInit() {
|
void beanInit() {
|
||||||
|
aopTest.aopLog2();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
Reference in New Issue
Block a user