From ba1cc8714762dde73a295ca55911c41c65bc5a19 Mon Sep 17 00:00:00 2001 From: Awais Haider Date: Mon, 13 Apr 2026 10:21:11 +0500 Subject: [PATCH] test(spring-spel): remove redundant new() on @Autowired fields in SpelIntegrationTest @Autowired field injection replaces field values after construction; the initial new() calls were unused and could mislead readers about the source of the beans. Made-with: Cursor --- .../java/com/baeldung/spel/SpelIntegrationTest.java | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/spring-spel/src/test/java/com/baeldung/spel/SpelIntegrationTest.java b/spring-spel/src/test/java/com/baeldung/spel/SpelIntegrationTest.java index bff42caead79..7f95e71af332 100644 --- a/spring-spel/src/test/java/com/baeldung/spel/SpelIntegrationTest.java +++ b/spring-spel/src/test/java/com/baeldung/spel/SpelIntegrationTest.java @@ -1,7 +1,6 @@ package com.baeldung.spel; import com.baeldung.spring.spel.examples.*; -import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; @@ -16,22 +15,22 @@ public class SpelIntegrationTest { @Autowired - private SpelArithmetic spelArithmetic = new SpelArithmetic(); + private SpelArithmetic spelArithmetic; @Autowired - private SpelCollections spelCollections = new SpelCollections(); + private SpelCollections spelCollections; @Autowired - private SpelConditional spelConditional = new SpelConditional(); + private SpelConditional spelConditional; @Autowired - private SpelLogical spelLogical = new SpelLogical(); + private SpelLogical spelLogical; @Autowired - private SpelRegex spelRegex = new SpelRegex(); + private SpelRegex spelRegex; @Autowired - private SpelRelational spelRelational = new SpelRelational(); + private SpelRelational spelRelational; @Test public void testArithmetic() throws Exception {