From 0d48dd5439820ef9e25029d0c1c054e844e3c2aa Mon Sep 17 00:00:00 2001 From: Amit Pandey Date: Tue, 9 Jan 2024 01:57:42 +0530 Subject: [PATCH] [JAVA-29177 ] - Update Spring-AOP from Boot 2 to Boot 3 (#15560) --- spring-aop/pom.xml | 9 +++++++-- .../com/baeldung/pointcutadvice/PerformanceAspect.java | 2 +- .../JoinPointAfterThrowingAspectIntegrationTest.java | 4 ++-- .../JoinPointAroundExceptionAspectIntegrationTest.java | 4 ++-- .../joinpoint/JoinPointBeforeAspectIntegrationTest.java | 4 ++-- .../pointcutadvice/AopLoggingIntegrationTest.java | 6 +++--- .../pointcutadvice/AopPerformanceIntegrationTest.java | 4 ++-- .../AopXmlConfigPerformanceIntegrationTest.java | 4 ++-- 8 files changed, 21 insertions(+), 16 deletions(-) diff --git a/spring-aop/pom.xml b/spring-aop/pom.xml index 2b84e2a432..8ff5f20126 100644 --- a/spring-aop/pom.xml +++ b/spring-aop/pom.xml @@ -9,9 +9,9 @@ com.baeldung - parent-boot-2 + parent-boot-3 0.0.1-SNAPSHOT - ../parent-boot-2 + ../parent-boot-3 @@ -27,6 +27,11 @@ org.springframework.boot spring-boot-starter-aop + + org.apache.commons + commons-lang3 + ${commons-lang3.version} + org.springframework.boot spring-boot-starter-test diff --git a/spring-aop/src/main/java/com/baeldung/pointcutadvice/PerformanceAspect.java b/spring-aop/src/main/java/com/baeldung/pointcutadvice/PerformanceAspect.java index 4f445e301e..1917a87c2f 100644 --- a/spring-aop/src/main/java/com/baeldung/pointcutadvice/PerformanceAspect.java +++ b/spring-aop/src/main/java/com/baeldung/pointcutadvice/PerformanceAspect.java @@ -13,7 +13,7 @@ import java.util.logging.Logger; @Component public class PerformanceAspect { - private static Logger logger = Logger.getLogger(PerformanceAspect.class.getName()); + private static final Logger logger = Logger.getLogger(PerformanceAspect.class.getName()); @Pointcut("within(com.baeldung..*) && execution(* com.baeldung.pointcutadvice.dao.FooDao.*(..))") public void repositoryClassMethods() { diff --git a/spring-aop/src/test/java/com/baeldung/joinpoint/JoinPointAfterThrowingAspectIntegrationTest.java b/spring-aop/src/test/java/com/baeldung/joinpoint/JoinPointAfterThrowingAspectIntegrationTest.java index cdef76ac0d..7a6f66c355 100644 --- a/spring-aop/src/test/java/com/baeldung/joinpoint/JoinPointAfterThrowingAspectIntegrationTest.java +++ b/spring-aop/src/test/java/com/baeldung/joinpoint/JoinPointAfterThrowingAspectIntegrationTest.java @@ -15,8 +15,8 @@ import java.util.logging.LogRecord; import java.util.logging.Logger; import static org.hamcrest.Matchers.hasSize; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertTrue; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest diff --git a/spring-aop/src/test/java/com/baeldung/joinpoint/JoinPointAroundExceptionAspectIntegrationTest.java b/spring-aop/src/test/java/com/baeldung/joinpoint/JoinPointAroundExceptionAspectIntegrationTest.java index dbdda30c15..5afadf1c99 100644 --- a/spring-aop/src/test/java/com/baeldung/joinpoint/JoinPointAroundExceptionAspectIntegrationTest.java +++ b/spring-aop/src/test/java/com/baeldung/joinpoint/JoinPointAroundExceptionAspectIntegrationTest.java @@ -15,8 +15,8 @@ import java.util.logging.LogRecord; import java.util.logging.Logger; import static org.hamcrest.Matchers.hasSize; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertTrue; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest diff --git a/spring-aop/src/test/java/com/baeldung/joinpoint/JoinPointBeforeAspectIntegrationTest.java b/spring-aop/src/test/java/com/baeldung/joinpoint/JoinPointBeforeAspectIntegrationTest.java index 631852d57f..87abf9afb5 100644 --- a/spring-aop/src/test/java/com/baeldung/joinpoint/JoinPointBeforeAspectIntegrationTest.java +++ b/spring-aop/src/test/java/com/baeldung/joinpoint/JoinPointBeforeAspectIntegrationTest.java @@ -15,8 +15,8 @@ import java.util.logging.LogRecord; import java.util.logging.Logger; import static org.hamcrest.Matchers.hasSize; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertTrue; @RunWith(SpringJUnit4ClassRunner.class) @SpringBootTest diff --git a/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopLoggingIntegrationTest.java b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopLoggingIntegrationTest.java index a687eec388..294d35f66d 100644 --- a/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopLoggingIntegrationTest.java +++ b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopLoggingIntegrationTest.java @@ -17,10 +17,10 @@ import java.util.logging.LogRecord; import java.util.logging.Logger; import java.util.regex.Pattern; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasSize; -import static org.hamcrest.core.IsCollectionContaining.hasItem; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; +import static org.hamcrest.core. IsIterableContaining.hasItem; +import static org.junit.jupiter.api.Assertions.assertTrue; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {Application.class}, loader = AnnotationConfigContextLoader.class) diff --git a/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopPerformanceIntegrationTest.java b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopPerformanceIntegrationTest.java index 5a7797e5cd..f5f6abacd0 100644 --- a/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopPerformanceIntegrationTest.java +++ b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopPerformanceIntegrationTest.java @@ -18,9 +18,9 @@ import java.util.logging.Logger; import java.util.regex.Pattern; import static org.hamcrest.CoreMatchers.notNullValue; +import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.hasSize; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; +import static org.junit.jupiter.api.Assertions.assertTrue; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration(classes = {Application.class}, loader = AnnotationConfigContextLoader.class) diff --git a/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopXmlConfigPerformanceIntegrationTest.java b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopXmlConfigPerformanceIntegrationTest.java index 5727cfd7bc..14846e37ef 100644 --- a/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopXmlConfigPerformanceIntegrationTest.java +++ b/spring-aop/src/test/java/com/baeldung/pointcutadvice/AopXmlConfigPerformanceIntegrationTest.java @@ -17,8 +17,8 @@ import java.util.regex.Pattern; import static org.hamcrest.CoreMatchers.notNullValue; import static org.hamcrest.Matchers.hasSize; -import static org.junit.Assert.assertThat; -import static org.junit.Assert.assertTrue; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.jupiter.api.Assertions.assertTrue; @RunWith(SpringJUnit4ClassRunner.class) @ContextConfiguration("/pointcutadvice/beans.xml")