diff --git a/spring-5/src/main/java/com/baeldung/components/AccountService.java b/spring-5/src/main/java/com/baeldung/annotationconfigvscomponentscan/components/AccountService.java similarity index 59% rename from spring-5/src/main/java/com/baeldung/components/AccountService.java rename to spring-5/src/main/java/com/baeldung/annotationconfigvscomponentscan/components/AccountService.java index c2f09c735e..1997163954 100644 --- a/spring-5/src/main/java/com/baeldung/components/AccountService.java +++ b/spring-5/src/main/java/com/baeldung/annotationconfigvscomponentscan/components/AccountService.java @@ -1,4 +1,4 @@ -package com.baeldung.components; +package com.baeldung.annotationconfigvscomponentscan.components; import org.springframework.stereotype.Component; diff --git a/spring-5/src/main/java/com/baeldung/components/UserService.java b/spring-5/src/main/java/com/baeldung/annotationconfigvscomponentscan/components/UserService.java similarity index 82% rename from spring-5/src/main/java/com/baeldung/components/UserService.java rename to spring-5/src/main/java/com/baeldung/annotationconfigvscomponentscan/components/UserService.java index 80e5e0c632..8dd5ae2ef0 100644 --- a/spring-5/src/main/java/com/baeldung/components/UserService.java +++ b/spring-5/src/main/java/com/baeldung/annotationconfigvscomponentscan/components/UserService.java @@ -1,4 +1,4 @@ -package com.baeldung.components; +package com.baeldung.annotationconfigvscomponentscan.components; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/spring-5/src/main/resources/beans.xml b/spring-5/src/main/resources/annotationconfigvscomponentscan-beans.xml similarity index 68% rename from spring-5/src/main/resources/beans.xml rename to spring-5/src/main/resources/annotationconfigvscomponentscan-beans.xml index 004745b817..ee4bbb6573 100644 --- a/spring-5/src/main/resources/beans.xml +++ b/spring-5/src/main/resources/annotationconfigvscomponentscan-beans.xml @@ -4,11 +4,11 @@ - + - + - + diff --git a/spring-5/src/test/java/com/baeldung/SpringXMLConfigurationIntegrationTest.java b/spring-5/src/test/java/com/baeldung/SpringXMLConfigurationIntegrationTest.java index 4ecad9c43e..7cd7b81def 100644 --- a/spring-5/src/test/java/com/baeldung/SpringXMLConfigurationIntegrationTest.java +++ b/spring-5/src/test/java/com/baeldung/SpringXMLConfigurationIntegrationTest.java @@ -5,14 +5,14 @@ import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; -import com.baeldung.components.AccountService; -import com.baeldung.components.UserService; +import com.baeldung.annotationconfigvscomponentscan.components.AccountService; +import com.baeldung.annotationconfigvscomponentscan.components.UserService; public class SpringXMLConfigurationIntegrationTest { @Test public void givenContextAnnotationConfigOrContextComponentScan_whenDependenciesAndBeansAnnotated_thenNoXMLNeeded() { - ApplicationContext context = new ClassPathXmlApplicationContext("classpath:beans.xml"); + ApplicationContext context = new ClassPathXmlApplicationContext("classpath:annotationconfigvscomponentscan-beans.xml"); UserService userService = context.getBean(UserService.class); AccountService accountService = context.getBean(AccountService.class); Assert.assertNotNull(userService);