From 8d6c2dc2ed835cf5275fbae269017560fb819e91 Mon Sep 17 00:00:00 2001 From: Sam Millington Date: Mon, 16 Sep 2019 11:00:12 +0100 Subject: [PATCH] =?UTF-8?q?[BAEL-16662]=20Move=20articles=20out=20of=20spr?= =?UTF-8?q?ing-core=20and=20into=20spring-di=20and=20=E2=80=A6=20(#7750)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [BAEL-16662] Move articles out of spring-core and into spring-di and spring-core-2 * [BAEL-16662] Fixed required config classes * [BAEL-16662] - Removed unused dependencies from spring-core --- spring-core-2/README.md | 3 + spring-core-2/pom.xml | 5 ++ .../com/baeldung/beanfactory/Employee.java | 0 .../com/baeldung/collection/BaeldungBean.java | 0 .../baeldung/collection/CollectionConfig.java | 0 .../collection/CollectionInjectionDemo.java | 0 .../baeldung/collection/CollectionsBean.java | 0 .../factorybean/FactoryBeanAppConfig.java | 0 .../factorybean/NonSingleToolFactory.java | 0 .../java/com/baeldung/factorybean/README.md | 0 .../factorybean/SingleToolFactory.java | 0 .../java/com/baeldung/factorybean/Tool.java | 0 .../com/baeldung/factorybean/ToolFactory.java | 0 ...yWithClassPathResourceIntegrationTest.java | 0 .../java/com/baeldung/beanfactory/README.md | 0 .../AbstractFactoryBeanIntegrationTest.java | 0 .../FactoryBeanJavaConfigIntegrationTest.java | 0 .../FactoryBeanXmlConfigIntegrationTest.java | 0 spring-core/README.md | 12 +-- ...pplicationContextTestResourceNameType.java | 0 ...plicationContextTestResourceQualifier.java | 0 spring-di/README.md | 8 ++ spring-di/pom.xml | 78 ++++++++++++++++--- .../CircularDependencyA.java | 0 .../CircularDependencyB.java | 0 .../com/baeldung/constructordi/Config.java | 0 .../baeldung/constructordi/SpringRunner.java | 62 +++++++-------- .../baeldung/constructordi/domain/Car.java | 42 +++++----- .../baeldung/constructordi/domain/Engine.java | 0 .../constructordi/domain/Transmission.java | 0 .../AnotherArbitraryDependency.java | 0 .../dependency/ArbitraryDependency.java | 0 .../YetAnotherArbitraryDependency.java | 0 .../exception/app/PurchaseDeptService.java | 0 .../SpringDependenciesExampleApplication.java | 0 .../exception/repository/DressRepository.java | 0 .../repository/InventoryRepository.java | 0 .../exception/repository/ShoeRepository.java | 0 .../ArticleFormatter.java | 0 .../ArticleWithConstructorInjection.java | 0 .../ArticleWithSetterInjection.java | 0 .../TextFormatter.java | 0 .../annotation/CarQualifier.java | 0 .../app/CustomConfiguration.java | 0 .../dependencyinjectiontypes/model/Car.java | 0 .../model/CarHandler.java | 0 .../model/Motorcycle.java | 0 .../model/Vehicle.java | 0 .../baeldung/dependson/DriverApplication.java | 0 .../com/baeldung/dependson/config/Config.java | 0 .../file/processor/FileProcessor.java | 0 .../dependson/file/reader/FileReader.java | 0 .../dependson/file/writer/FileWriter.java | 0 .../com/baeldung/dependson/shared/File.java | 0 .../java/com/baeldung/di/spring/Account.java | 54 ++++++------- .../baeldung/di/spring/AccountService.java | 10 +-- .../di/spring/AccountServiceImpl.java | 16 ++-- .../baeldung/di/spring/AudioBookService.java | 0 .../di/spring/AudioBookServiceImpl.java | 0 .../com/baeldung/di/spring/AuthorService.java | 0 .../baeldung/di/spring/AuthorServiceImpl.java | 0 .../com/baeldung/di/spring/BookService.java | 10 +-- .../baeldung/di/spring/BookServiceImpl.java | 20 ++--- .../main/java/com/baeldung/di/spring/Foo.java | 8 +- .../com/baeldung/di/spring/FooProcessor.java | 10 +-- .../java/com/baeldung/di/spring/IService.java | 10 +-- .../java/com/baeldung/di/spring/IndexApp.java | 38 ++++----- .../com/baeldung/di/spring/IndexService.java | 20 ++--- .../di/spring/InstanceServiceFactory.java | 28 +++---- .../com/baeldung/di/spring/MessageApp.java | 28 +++---- .../baeldung/di/spring/MessageService.java | 32 ++++---- .../com/baeldung/di/spring/PersonDao.java | 0 .../com/baeldung/di/spring/PersonDaoImpl.java | 0 .../baeldung/di/spring/SpringBeansConfig.java | 0 .../baeldung/di/spring/SpringMainConfig.java | 36 ++++----- .../di/spring/SpringPersonService.java | 0 .../di/spring/StaticServiceFactory.java | 28 +++---- .../com/baeldung/di/spring/UserService.java | 40 +++++----- .../baeldung/methodinjections/AppConfig.java | 10 +++ .../com/baeldung/methodinjections/Grader.java | 19 +++++ .../methodinjections/SchoolNotification.java | 45 +++++++++++ .../baeldung/methodinjections/Student.java | 27 +++++++ .../methodinjections/StudentServices.java | 21 +++++ .../{org => com}/baeldung/sample/App.java | 2 +- .../baeldung/sample/AppConfig.java | 2 +- .../main/java/com/baeldung/sample/Bar.java | 5 ++ .../baeldung/sample/BarFormatter.java | 2 +- .../main/java/com/baeldung/sample/Foo.java | 5 ++ .../main/java/com/baeldung/sample/FooDAO.java | 5 ++ .../baeldung/sample/FooFormatter.java | 2 +- .../baeldung/sample/FooService.java | 2 +- .../baeldung/sample/Formatter.java | 2 +- .../baeldung/sample/FormatterType.java | 2 +- .../main/java/org/baeldung/sample/Bar.java | 5 -- .../main/java/org/baeldung/sample/Foo.java | 5 -- .../main/java/org/baeldung/sample/FooDAO.java | 5 -- .../src/main/resources/application.properties | 2 + spring-di/src/main/resources/baeldung.xml | 20 +++++ .../resources/beaninjectiontypes-context.xml | 22 ++++++ spring-di/src/main/resources/beans.xml | 15 ++++ ...classpathxmlapplicationcontext-example.xml | 18 +++++ ...pplicationcontext-internationalization.xml | 14 ++++ .../com.baeldung.di.spring.properties | 1 + .../main/resources/com.baeldung.di.spring.xml | 43 ++++++++++ .../src/main/resources/constructordi.xml | 22 ++++++ .../dependencyinjectiontypes-context.xml | 23 ++++++ .../resources/dialog/dialog_en.properties | 3 + .../resources/dialog/dialog_zh_CN.properties | 3 + .../factorybean-abstract-spring-ctx.xml | 15 ++++ .../main/resources/factorybean-spring-ctx.xml | 10 +++ .../src/main/resources/injectiontypes.xml | 15 ++++ spring-di/src/main/resources/logback.xml | 13 ++++ spring-di/src/main/resources/setterdi.xml | 24 ++++++ .../FieldAutowiredIntegrationTest.java | 0 .../FieldAutowiredNameIntegrationTest.java | 0 ...ieldQualifierAutowiredIntegrationTest.java | 0 .../CircularDependencyIntegrationTest.java | 0 .../circulardependency/TestConfig.java | 0 .../ApplicationContextTestAutowiredName.java | 0 ...licationContextTestAutowiredQualifier.java | 0 .../ApplicationContextTestAutowiredType.java | 0 .../ApplicationContextTestInjectName.java | 0 ...ApplicationContextTestInjectQualifier.java | 0 .../ApplicationContextTestInjectType.java | 0 ...torDependencyInjectionIntegrationTest.java | 0 .../DependencyInjectionIntegrationTest.java | 0 .../baeldung/dependson/config/TestConfig.java | 0 .../FileProcessorIntegrationTest.java | 0 .../spring/BeanInjectionIntegrationTest.java | 62 +++++++-------- .../baeldung/di/spring/SpringUnitTest.java | 0 .../FieldByNameInjectIntegrationTest.java | 0 .../inject/FieldInjectIntegrationTest.java | 0 .../FieldQualifierInjectIntegrationTest.java | 0 .../StudentIntegrationTest.java | 0 .../sample/FooServiceIntegrationTest.java | 2 +- .../test/resources/beanfactory-example.xml | 13 ++++ .../src/test/resources/data/employees.dat | 1 + spring-di/src/test/resources/input.txt | 1 + spring-di/src/test/resources/output.txt | 1 + 139 files changed, 787 insertions(+), 320 deletions(-) rename {spring-core => spring-core-2}/src/main/java/com/baeldung/beanfactory/Employee.java (100%) rename {spring-core => spring-core-2}/src/main/java/com/baeldung/collection/BaeldungBean.java (100%) rename {spring-core => spring-core-2}/src/main/java/com/baeldung/collection/CollectionConfig.java (100%) rename {spring-core => spring-core-2}/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java (100%) rename {spring-core => spring-core-2}/src/main/java/com/baeldung/collection/CollectionsBean.java (100%) rename {spring-core => spring-core-2}/src/main/java/com/baeldung/factorybean/FactoryBeanAppConfig.java (100%) rename {spring-core => spring-core-2}/src/main/java/com/baeldung/factorybean/NonSingleToolFactory.java (100%) rename {spring-core => spring-core-2}/src/main/java/com/baeldung/factorybean/README.md (100%) rename {spring-core => spring-core-2}/src/main/java/com/baeldung/factorybean/SingleToolFactory.java (100%) rename {spring-core => spring-core-2}/src/main/java/com/baeldung/factorybean/Tool.java (100%) rename {spring-core => spring-core-2}/src/main/java/com/baeldung/factorybean/ToolFactory.java (100%) rename {spring-core => spring-core-2}/src/test/java/com/baeldung/beanfactory/BeanFactoryWithClassPathResourceIntegrationTest.java (100%) rename {spring-core => spring-core-2}/src/test/java/com/baeldung/beanfactory/README.md (100%) rename {spring-core => spring-core-2}/src/test/java/com/baeldung/factorybean/AbstractFactoryBeanIntegrationTest.java (100%) rename {spring-core => spring-core-2}/src/test/java/com/baeldung/factorybean/FactoryBeanJavaConfigIntegrationTest.java (100%) rename {spring-core => spring-core-2}/src/test/java/com/baeldung/factorybean/FactoryBeanXmlConfigIntegrationTest.java (100%) rename spring-core/src/{main => test}/java/com/baeldung/configuration/ApplicationContextTestResourceNameType.java (100%) rename spring-core/src/{main => test}/java/com/baeldung/configuration/ApplicationContextTestResourceQualifier.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/circulardependency/CircularDependencyA.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/circulardependency/CircularDependencyB.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/constructordi/Config.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/constructordi/SpringRunner.java (96%) rename {spring-core => spring-di}/src/main/java/com/baeldung/constructordi/domain/Car.java (96%) rename {spring-core => spring-di}/src/main/java/com/baeldung/constructordi/domain/Engine.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/constructordi/domain/Transmission.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependency/AnotherArbitraryDependency.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependency/ArbitraryDependency.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependency/YetAnotherArbitraryDependency.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependency/exception/app/PurchaseDeptService.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependency/exception/app/SpringDependenciesExampleApplication.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependency/exception/repository/DressRepository.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependency/exception/repository/InventoryRepository.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependency/exception/repository/ShoeRepository.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependencyinjectiontypes/ArticleFormatter.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependencyinjectiontypes/ArticleWithConstructorInjection.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependencyinjectiontypes/ArticleWithSetterInjection.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependencyinjectiontypes/TextFormatter.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependencyinjectiontypes/annotation/CarQualifier.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependencyinjectiontypes/app/CustomConfiguration.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependencyinjectiontypes/model/Car.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependencyinjectiontypes/model/CarHandler.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependencyinjectiontypes/model/Motorcycle.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependencyinjectiontypes/model/Vehicle.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependson/DriverApplication.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependson/config/Config.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependson/file/processor/FileProcessor.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependson/file/reader/FileReader.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependson/file/writer/FileWriter.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/dependson/shared/File.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/Account.java (94%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/AccountService.java (93%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/AccountServiceImpl.java (95%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/AudioBookService.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/AudioBookServiceImpl.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/AuthorService.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/AuthorServiceImpl.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/BookService.java (93%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/BookServiceImpl.java (95%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/Foo.java (93%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/FooProcessor.java (94%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/IService.java (94%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/IndexApp.java (94%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/IndexService.java (94%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/InstanceServiceFactory.java (96%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/MessageApp.java (94%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/MessageService.java (94%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/PersonDao.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/PersonDaoImpl.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/SpringBeansConfig.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/SpringMainConfig.java (96%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/SpringPersonService.java (100%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/StaticServiceFactory.java (96%) rename {spring-core => spring-di}/src/main/java/com/baeldung/di/spring/UserService.java (95%) create mode 100644 spring-di/src/main/java/com/baeldung/methodinjections/AppConfig.java create mode 100644 spring-di/src/main/java/com/baeldung/methodinjections/Grader.java create mode 100644 spring-di/src/main/java/com/baeldung/methodinjections/SchoolNotification.java create mode 100644 spring-di/src/main/java/com/baeldung/methodinjections/Student.java create mode 100644 spring-di/src/main/java/com/baeldung/methodinjections/StudentServices.java rename spring-di/src/main/java/{org => com}/baeldung/sample/App.java (92%) rename spring-di/src/main/java/{org => com}/baeldung/sample/AppConfig.java (87%) create mode 100644 spring-di/src/main/java/com/baeldung/sample/Bar.java rename spring-di/src/main/java/{org => com}/baeldung/sample/BarFormatter.java (86%) create mode 100644 spring-di/src/main/java/com/baeldung/sample/Foo.java create mode 100644 spring-di/src/main/java/com/baeldung/sample/FooDAO.java rename spring-di/src/main/java/{org => com}/baeldung/sample/FooFormatter.java (86%) rename spring-di/src/main/java/{org => com}/baeldung/sample/FooService.java (91%) rename spring-di/src/main/java/{org => com}/baeldung/sample/Formatter.java (65%) rename spring-di/src/main/java/{org => com}/baeldung/sample/FormatterType.java (93%) delete mode 100644 spring-di/src/main/java/org/baeldung/sample/Bar.java delete mode 100644 spring-di/src/main/java/org/baeldung/sample/Foo.java delete mode 100644 spring-di/src/main/java/org/baeldung/sample/FooDAO.java create mode 100644 spring-di/src/main/resources/application.properties create mode 100644 spring-di/src/main/resources/baeldung.xml create mode 100644 spring-di/src/main/resources/beaninjectiontypes-context.xml create mode 100644 spring-di/src/main/resources/beans.xml create mode 100644 spring-di/src/main/resources/classpathxmlapplicationcontext-example.xml create mode 100644 spring-di/src/main/resources/classpathxmlapplicationcontext-internationalization.xml create mode 100644 spring-di/src/main/resources/com.baeldung.di.spring.properties create mode 100644 spring-di/src/main/resources/com.baeldung.di.spring.xml create mode 100644 spring-di/src/main/resources/constructordi.xml create mode 100644 spring-di/src/main/resources/dependencyinjectiontypes-context.xml create mode 100644 spring-di/src/main/resources/dialog/dialog_en.properties create mode 100644 spring-di/src/main/resources/dialog/dialog_zh_CN.properties create mode 100644 spring-di/src/main/resources/factorybean-abstract-spring-ctx.xml create mode 100644 spring-di/src/main/resources/factorybean-spring-ctx.xml create mode 100644 spring-di/src/main/resources/injectiontypes.xml create mode 100644 spring-di/src/main/resources/logback.xml create mode 100644 spring-di/src/main/resources/setterdi.xml rename {spring-core => spring-di}/src/test/java/com/baeldung/autowired/FieldAutowiredIntegrationTest.java (100%) rename {spring-core => spring-di}/src/test/java/com/baeldung/autowired/FieldAutowiredNameIntegrationTest.java (100%) rename {spring-core => spring-di}/src/test/java/com/baeldung/autowired/FieldQualifierAutowiredIntegrationTest.java (100%) rename {spring-core => spring-di}/src/test/java/com/baeldung/circulardependency/CircularDependencyIntegrationTest.java (100%) rename {spring-core => spring-di}/src/test/java/com/baeldung/circulardependency/TestConfig.java (100%) rename {spring-core/src/main => spring-di/src/test}/java/com/baeldung/configuration/ApplicationContextTestAutowiredName.java (100%) rename {spring-core/src/main => spring-di/src/test}/java/com/baeldung/configuration/ApplicationContextTestAutowiredQualifier.java (100%) rename {spring-core/src/main => spring-di/src/test}/java/com/baeldung/configuration/ApplicationContextTestAutowiredType.java (100%) rename {spring-core/src/main => spring-di/src/test}/java/com/baeldung/configuration/ApplicationContextTestInjectName.java (100%) rename {spring-core/src/main => spring-di/src/test}/java/com/baeldung/configuration/ApplicationContextTestInjectQualifier.java (100%) rename {spring-core/src/main => spring-di/src/test}/java/com/baeldung/configuration/ApplicationContextTestInjectType.java (100%) rename {spring-core => spring-di}/src/test/java/com/baeldung/constructordi/ConstructorDependencyInjectionIntegrationTest.java (100%) rename {spring-core => spring-di}/src/test/java/com/baeldung/dependencyinjectiontypes/DependencyInjectionIntegrationTest.java (100%) rename {spring-core => spring-di}/src/test/java/com/baeldung/dependson/config/TestConfig.java (100%) rename {spring-core => spring-di}/src/test/java/com/baeldung/dependson/processor/FileProcessorIntegrationTest.java (100%) rename {spring-core => spring-di}/src/test/java/com/baeldung/di/spring/BeanInjectionIntegrationTest.java (96%) rename {spring-core => spring-di}/src/test/java/com/baeldung/di/spring/SpringUnitTest.java (100%) rename {spring-core => spring-di}/src/test/java/com/baeldung/inject/FieldByNameInjectIntegrationTest.java (100%) rename {spring-core => spring-di}/src/test/java/com/baeldung/inject/FieldInjectIntegrationTest.java (100%) rename {spring-core => spring-di}/src/test/java/com/baeldung/inject/FieldQualifierInjectIntegrationTest.java (100%) rename {spring-core => spring-di}/src/test/java/com/baeldung/methodinjections/StudentIntegrationTest.java (100%) rename spring-di/src/test/java/{org => com}/baeldung/sample/FooServiceIntegrationTest.java (96%) create mode 100644 spring-di/src/test/resources/beanfactory-example.xml create mode 100644 spring-di/src/test/resources/data/employees.dat create mode 100644 spring-di/src/test/resources/input.txt create mode 100644 spring-di/src/test/resources/output.txt diff --git a/spring-core-2/README.md b/spring-core-2/README.md index 4c9e3b9ddf..113bbe9c83 100644 --- a/spring-core-2/README.md +++ b/spring-core-2/README.md @@ -1,3 +1,6 @@ ## Relevant Articles: - [Understanding getBean() in Spring](https://www.baeldung.com/spring-getbean) +- [Exploring the Spring BeanFactory API](http://www.baeldung.com/spring-beanfactory) +- [How to use the Spring FactoryBean?](http://www.baeldung.com/spring-factorybean) +- [Spring – Injecting Collections](http://www.baeldung.com/spring-injecting-collections) diff --git a/spring-core-2/pom.xml b/spring-core-2/pom.xml index d68beda64a..c9334e3d38 100644 --- a/spring-core-2/pom.xml +++ b/spring-core-2/pom.xml @@ -14,6 +14,11 @@ + + org.springframework + spring-test + ${spring.version} + org.springframework spring-beans diff --git a/spring-core/src/main/java/com/baeldung/beanfactory/Employee.java b/spring-core-2/src/main/java/com/baeldung/beanfactory/Employee.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/beanfactory/Employee.java rename to spring-core-2/src/main/java/com/baeldung/beanfactory/Employee.java diff --git a/spring-core/src/main/java/com/baeldung/collection/BaeldungBean.java b/spring-core-2/src/main/java/com/baeldung/collection/BaeldungBean.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/collection/BaeldungBean.java rename to spring-core-2/src/main/java/com/baeldung/collection/BaeldungBean.java diff --git a/spring-core/src/main/java/com/baeldung/collection/CollectionConfig.java b/spring-core-2/src/main/java/com/baeldung/collection/CollectionConfig.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/collection/CollectionConfig.java rename to spring-core-2/src/main/java/com/baeldung/collection/CollectionConfig.java diff --git a/spring-core/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java b/spring-core-2/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java rename to spring-core-2/src/main/java/com/baeldung/collection/CollectionInjectionDemo.java diff --git a/spring-core/src/main/java/com/baeldung/collection/CollectionsBean.java b/spring-core-2/src/main/java/com/baeldung/collection/CollectionsBean.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/collection/CollectionsBean.java rename to spring-core-2/src/main/java/com/baeldung/collection/CollectionsBean.java diff --git a/spring-core/src/main/java/com/baeldung/factorybean/FactoryBeanAppConfig.java b/spring-core-2/src/main/java/com/baeldung/factorybean/FactoryBeanAppConfig.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/factorybean/FactoryBeanAppConfig.java rename to spring-core-2/src/main/java/com/baeldung/factorybean/FactoryBeanAppConfig.java diff --git a/spring-core/src/main/java/com/baeldung/factorybean/NonSingleToolFactory.java b/spring-core-2/src/main/java/com/baeldung/factorybean/NonSingleToolFactory.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/factorybean/NonSingleToolFactory.java rename to spring-core-2/src/main/java/com/baeldung/factorybean/NonSingleToolFactory.java diff --git a/spring-core/src/main/java/com/baeldung/factorybean/README.md b/spring-core-2/src/main/java/com/baeldung/factorybean/README.md similarity index 100% rename from spring-core/src/main/java/com/baeldung/factorybean/README.md rename to spring-core-2/src/main/java/com/baeldung/factorybean/README.md diff --git a/spring-core/src/main/java/com/baeldung/factorybean/SingleToolFactory.java b/spring-core-2/src/main/java/com/baeldung/factorybean/SingleToolFactory.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/factorybean/SingleToolFactory.java rename to spring-core-2/src/main/java/com/baeldung/factorybean/SingleToolFactory.java diff --git a/spring-core/src/main/java/com/baeldung/factorybean/Tool.java b/spring-core-2/src/main/java/com/baeldung/factorybean/Tool.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/factorybean/Tool.java rename to spring-core-2/src/main/java/com/baeldung/factorybean/Tool.java diff --git a/spring-core/src/main/java/com/baeldung/factorybean/ToolFactory.java b/spring-core-2/src/main/java/com/baeldung/factorybean/ToolFactory.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/factorybean/ToolFactory.java rename to spring-core-2/src/main/java/com/baeldung/factorybean/ToolFactory.java diff --git a/spring-core/src/test/java/com/baeldung/beanfactory/BeanFactoryWithClassPathResourceIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/beanfactory/BeanFactoryWithClassPathResourceIntegrationTest.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/beanfactory/BeanFactoryWithClassPathResourceIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/beanfactory/BeanFactoryWithClassPathResourceIntegrationTest.java diff --git a/spring-core/src/test/java/com/baeldung/beanfactory/README.md b/spring-core-2/src/test/java/com/baeldung/beanfactory/README.md similarity index 100% rename from spring-core/src/test/java/com/baeldung/beanfactory/README.md rename to spring-core-2/src/test/java/com/baeldung/beanfactory/README.md diff --git a/spring-core/src/test/java/com/baeldung/factorybean/AbstractFactoryBeanIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/factorybean/AbstractFactoryBeanIntegrationTest.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/factorybean/AbstractFactoryBeanIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/factorybean/AbstractFactoryBeanIntegrationTest.java diff --git a/spring-core/src/test/java/com/baeldung/factorybean/FactoryBeanJavaConfigIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/factorybean/FactoryBeanJavaConfigIntegrationTest.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/factorybean/FactoryBeanJavaConfigIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/factorybean/FactoryBeanJavaConfigIntegrationTest.java diff --git a/spring-core/src/test/java/com/baeldung/factorybean/FactoryBeanXmlConfigIntegrationTest.java b/spring-core-2/src/test/java/com/baeldung/factorybean/FactoryBeanXmlConfigIntegrationTest.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/factorybean/FactoryBeanXmlConfigIntegrationTest.java rename to spring-core-2/src/test/java/com/baeldung/factorybean/FactoryBeanXmlConfigIntegrationTest.java diff --git a/spring-core/README.md b/spring-core/README.md index 111b034bef..3ff3f1ea41 100644 --- a/spring-core/README.md +++ b/spring-core/README.md @@ -1,22 +1,12 @@ ### Relevant Articles: - [Wiring in Spring: @Autowired, @Resource and @Inject](http://www.baeldung.com/spring-annotations-resource-inject-autowire) -- [Exploring the Spring BeanFactory API](http://www.baeldung.com/spring-beanfactory) -- [How to use the Spring FactoryBean?](http://www.baeldung.com/spring-factorybean) -- [Constructor Dependency Injection in Spring](http://www.baeldung.com/constructor-injection-in-spring) - [Constructor Injection in Spring with Lombok](http://www.baeldung.com/spring-injection-lombok) - [Introduction to Spring’s StreamUtils](http://www.baeldung.com/spring-stream-utils) - [XML-Based Injection in Spring](http://www.baeldung.com/spring-xml-injection) - [A Quick Guide to the Spring @Lazy Annotation](http://www.baeldung.com/spring-lazy-annotation) -- [Injecting Prototype Beans into a Singleton Instance in Spring](http://www.baeldung.com/spring-inject-prototype-bean-into-singleton) -- [@Lookup Annotation in Spring](http://www.baeldung.com/spring-lookup) - [BeanNameAware and BeanFactoryAware Interfaces in Spring](http://www.baeldung.com/spring-bean-name-factory-aware) -- [Spring – Injecting Collections](http://www.baeldung.com/spring-injecting-collections) - [Access a File from the Classpath in a Spring Application](http://www.baeldung.com/spring-classpath-file-access) -- [Controlling Bean Creation Order with @DependsOn Annotation](http://www.baeldung.com/spring-depends-on) -- [Spring Autowiring of Generic Types](https://www.baeldung.com/spring-autowire-generics) - [Spring Application Context Events](https://www.baeldung.com/spring-context-events) -- [Unsatisfied Dependency in Spring](https://www.baeldung.com/spring-unsatisfied-dependency) - [What is a Spring Bean?](https://www.baeldung.com/spring-bean) - [Spring PostConstruct and PreDestroy Annotations](https://www.baeldung.com/spring-postconstruct-predestroy) -- [Guice vs Spring – Dependency Injection](https://www.baeldung.com/guice-spring-dependency-injection) -- [Circular Dependencies in Spring](http://www.baeldung.com/circular-dependencies-in-spring) + diff --git a/spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestResourceNameType.java b/spring-core/src/test/java/com/baeldung/configuration/ApplicationContextTestResourceNameType.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestResourceNameType.java rename to spring-core/src/test/java/com/baeldung/configuration/ApplicationContextTestResourceNameType.java diff --git a/spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestResourceQualifier.java b/spring-core/src/test/java/com/baeldung/configuration/ApplicationContextTestResourceQualifier.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestResourceQualifier.java rename to spring-core/src/test/java/com/baeldung/configuration/ApplicationContextTestResourceQualifier.java diff --git a/spring-di/README.md b/spring-di/README.md index a61ebe5127..59651751ee 100644 --- a/spring-di/README.md +++ b/spring-di/README.md @@ -1,3 +1,11 @@ ### Relevant Articles - [The Spring @Qualifier Annotation](https://www.baeldung.com/spring-qualifier-annotation) +- [Constructor Dependency Injection in Spring](http://www.baeldung.com/constructor-injection-in-spring) +- [Spring Autowiring of Generic Types](https://www.baeldung.com/spring-autowire-generics) +- [Guice vs Spring – Dependency Injection](https://www.baeldung.com/guice-spring-dependency-injection) +- [Injecting Prototype Beans into a Singleton Instance in Spring](http://www.baeldung.com/spring-inject-prototype-bean-into-singleton) +- [@Lookup Annotation in Spring](http://www.baeldung.com/spring-lookup) +- [Controlling Bean Creation Order with @DependsOn Annotation](http://www.baeldung.com/spring-depends-on) +- [Unsatisfied Dependency in Spring](https://www.baeldung.com/spring-unsatisfied-dependency) +- [Circular Dependencies in Spring](http://www.baeldung.com/circular-dependencies-in-spring) diff --git a/spring-di/pom.xml b/spring-di/pom.xml index f3ad380778..53a4ae58c6 100644 --- a/spring-di/pom.xml +++ b/spring-di/pom.xml @@ -9,18 +9,70 @@ spring-di - parent-boot-2 com.baeldung + parent-spring-5 0.0.1-SNAPSHOT - ../parent-boot-2 + ../parent-spring-5 - + + org.springframework + spring-test + ${spring.version} + + + org.springframework + spring-beans + ${spring.version} + org.springframework spring-context + ${spring.version} + + javax.inject + javax.inject + ${javax.inject.version} + + + com.google.guava + guava + ${guava.version} + + + org.projectlombok + lombok + ${lombok.version} + + + org.springframework.boot + spring-boot-starter + ${spring-boot.version} + + + org.springframework.boot + spring-boot-test + ${mockito.spring.boot.version} + test + + + org.assertj + assertj-core + ${assertj.version} + test + + + commons-io + commons-io + ${commons.io.version} + + + + + + javax.annotation @@ -28,12 +80,12 @@ ${annotation-api.version} - - - org.springframework - spring-test - test - + + + + + + @@ -97,6 +149,14 @@ 5.0.6.RELEASE 1.3.2 + + 1.4.4.RELEASE + 1 + 20.0 + 2.5 + 1.5.2.RELEASE + 1.10.19 + 3.12.2 \ No newline at end of file diff --git a/spring-core/src/main/java/com/baeldung/circulardependency/CircularDependencyA.java b/spring-di/src/main/java/com/baeldung/circulardependency/CircularDependencyA.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/circulardependency/CircularDependencyA.java rename to spring-di/src/main/java/com/baeldung/circulardependency/CircularDependencyA.java diff --git a/spring-core/src/main/java/com/baeldung/circulardependency/CircularDependencyB.java b/spring-di/src/main/java/com/baeldung/circulardependency/CircularDependencyB.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/circulardependency/CircularDependencyB.java rename to spring-di/src/main/java/com/baeldung/circulardependency/CircularDependencyB.java diff --git a/spring-core/src/main/java/com/baeldung/constructordi/Config.java b/spring-di/src/main/java/com/baeldung/constructordi/Config.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/constructordi/Config.java rename to spring-di/src/main/java/com/baeldung/constructordi/Config.java diff --git a/spring-core/src/main/java/com/baeldung/constructordi/SpringRunner.java b/spring-di/src/main/java/com/baeldung/constructordi/SpringRunner.java similarity index 96% rename from spring-core/src/main/java/com/baeldung/constructordi/SpringRunner.java rename to spring-di/src/main/java/com/baeldung/constructordi/SpringRunner.java index bffd35ec59..abbe97a4bd 100644 --- a/spring-core/src/main/java/com/baeldung/constructordi/SpringRunner.java +++ b/spring-di/src/main/java/com/baeldung/constructordi/SpringRunner.java @@ -1,31 +1,31 @@ -package com.baeldung.constructordi; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import com.baeldung.constructordi.domain.Car; - -public class SpringRunner { - public static void main(String[] args) { - Car toyota = getCarFromXml(); - - System.out.println(toyota); - - toyota = getCarFromJavaConfig(); - - System.out.println(toyota); - } - - private static Car getCarFromJavaConfig() { - ApplicationContext context = new AnnotationConfigApplicationContext(Config.class); - - return context.getBean(Car.class); - } - - private static Car getCarFromXml() { - ApplicationContext context = new ClassPathXmlApplicationContext("constructordi.xml"); - - return context.getBean(Car.class); - } -} +package com.baeldung.constructordi; + +import org.springframework.context.ApplicationContext; +import org.springframework.context.annotation.AnnotationConfigApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +import com.baeldung.constructordi.domain.Car; + +public class SpringRunner { + public static void main(String[] args) { + Car toyota = getCarFromXml(); + + System.out.println(toyota); + + toyota = getCarFromJavaConfig(); + + System.out.println(toyota); + } + + private static Car getCarFromJavaConfig() { + ApplicationContext context = new AnnotationConfigApplicationContext(Config.class); + + return context.getBean(Car.class); + } + + private static Car getCarFromXml() { + ApplicationContext context = new ClassPathXmlApplicationContext("constructordi.xml"); + + return context.getBean(Car.class); + } +} diff --git a/spring-core/src/main/java/com/baeldung/constructordi/domain/Car.java b/spring-di/src/main/java/com/baeldung/constructordi/domain/Car.java similarity index 96% rename from spring-core/src/main/java/com/baeldung/constructordi/domain/Car.java rename to spring-di/src/main/java/com/baeldung/constructordi/domain/Car.java index 5c9467fdf4..9f68ba5cd9 100644 --- a/spring-core/src/main/java/com/baeldung/constructordi/domain/Car.java +++ b/spring-di/src/main/java/com/baeldung/constructordi/domain/Car.java @@ -1,21 +1,21 @@ -package com.baeldung.constructordi.domain; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class Car { - private Engine engine; - private Transmission transmission; - - @Autowired - public Car(Engine engine, Transmission transmission) { - this.engine = engine; - this.transmission = transmission; - } - - @Override - public String toString() { - return String.format("Engine: %s Transmission: %s", engine, transmission); - } -} +package com.baeldung.constructordi.domain; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class Car { + private Engine engine; + private Transmission transmission; + + @Autowired + public Car(Engine engine, Transmission transmission) { + this.engine = engine; + this.transmission = transmission; + } + + @Override + public String toString() { + return String.format("Engine: %s Transmission: %s", engine, transmission); + } +} diff --git a/spring-core/src/main/java/com/baeldung/constructordi/domain/Engine.java b/spring-di/src/main/java/com/baeldung/constructordi/domain/Engine.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/constructordi/domain/Engine.java rename to spring-di/src/main/java/com/baeldung/constructordi/domain/Engine.java diff --git a/spring-core/src/main/java/com/baeldung/constructordi/domain/Transmission.java b/spring-di/src/main/java/com/baeldung/constructordi/domain/Transmission.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/constructordi/domain/Transmission.java rename to spring-di/src/main/java/com/baeldung/constructordi/domain/Transmission.java diff --git a/spring-core/src/main/java/com/baeldung/dependency/AnotherArbitraryDependency.java b/spring-di/src/main/java/com/baeldung/dependency/AnotherArbitraryDependency.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependency/AnotherArbitraryDependency.java rename to spring-di/src/main/java/com/baeldung/dependency/AnotherArbitraryDependency.java diff --git a/spring-core/src/main/java/com/baeldung/dependency/ArbitraryDependency.java b/spring-di/src/main/java/com/baeldung/dependency/ArbitraryDependency.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependency/ArbitraryDependency.java rename to spring-di/src/main/java/com/baeldung/dependency/ArbitraryDependency.java diff --git a/spring-core/src/main/java/com/baeldung/dependency/YetAnotherArbitraryDependency.java b/spring-di/src/main/java/com/baeldung/dependency/YetAnotherArbitraryDependency.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependency/YetAnotherArbitraryDependency.java rename to spring-di/src/main/java/com/baeldung/dependency/YetAnotherArbitraryDependency.java diff --git a/spring-core/src/main/java/com/baeldung/dependency/exception/app/PurchaseDeptService.java b/spring-di/src/main/java/com/baeldung/dependency/exception/app/PurchaseDeptService.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependency/exception/app/PurchaseDeptService.java rename to spring-di/src/main/java/com/baeldung/dependency/exception/app/PurchaseDeptService.java diff --git a/spring-core/src/main/java/com/baeldung/dependency/exception/app/SpringDependenciesExampleApplication.java b/spring-di/src/main/java/com/baeldung/dependency/exception/app/SpringDependenciesExampleApplication.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependency/exception/app/SpringDependenciesExampleApplication.java rename to spring-di/src/main/java/com/baeldung/dependency/exception/app/SpringDependenciesExampleApplication.java diff --git a/spring-core/src/main/java/com/baeldung/dependency/exception/repository/DressRepository.java b/spring-di/src/main/java/com/baeldung/dependency/exception/repository/DressRepository.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependency/exception/repository/DressRepository.java rename to spring-di/src/main/java/com/baeldung/dependency/exception/repository/DressRepository.java diff --git a/spring-core/src/main/java/com/baeldung/dependency/exception/repository/InventoryRepository.java b/spring-di/src/main/java/com/baeldung/dependency/exception/repository/InventoryRepository.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependency/exception/repository/InventoryRepository.java rename to spring-di/src/main/java/com/baeldung/dependency/exception/repository/InventoryRepository.java diff --git a/spring-core/src/main/java/com/baeldung/dependency/exception/repository/ShoeRepository.java b/spring-di/src/main/java/com/baeldung/dependency/exception/repository/ShoeRepository.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependency/exception/repository/ShoeRepository.java rename to spring-di/src/main/java/com/baeldung/dependency/exception/repository/ShoeRepository.java diff --git a/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/ArticleFormatter.java b/spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/ArticleFormatter.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/ArticleFormatter.java rename to spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/ArticleFormatter.java diff --git a/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/ArticleWithConstructorInjection.java b/spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/ArticleWithConstructorInjection.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/ArticleWithConstructorInjection.java rename to spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/ArticleWithConstructorInjection.java diff --git a/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/ArticleWithSetterInjection.java b/spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/ArticleWithSetterInjection.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/ArticleWithSetterInjection.java rename to spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/ArticleWithSetterInjection.java diff --git a/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/TextFormatter.java b/spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/TextFormatter.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/TextFormatter.java rename to spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/TextFormatter.java diff --git a/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/annotation/CarQualifier.java b/spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/annotation/CarQualifier.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/annotation/CarQualifier.java rename to spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/annotation/CarQualifier.java diff --git a/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/app/CustomConfiguration.java b/spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/app/CustomConfiguration.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/app/CustomConfiguration.java rename to spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/app/CustomConfiguration.java diff --git a/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Car.java b/spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/model/Car.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Car.java rename to spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/model/Car.java diff --git a/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/CarHandler.java b/spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/model/CarHandler.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/CarHandler.java rename to spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/model/CarHandler.java diff --git a/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Motorcycle.java b/spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/model/Motorcycle.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Motorcycle.java rename to spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/model/Motorcycle.java diff --git a/spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Vehicle.java b/spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/model/Vehicle.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependencyinjectiontypes/model/Vehicle.java rename to spring-di/src/main/java/com/baeldung/dependencyinjectiontypes/model/Vehicle.java diff --git a/spring-core/src/main/java/com/baeldung/dependson/DriverApplication.java b/spring-di/src/main/java/com/baeldung/dependson/DriverApplication.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependson/DriverApplication.java rename to spring-di/src/main/java/com/baeldung/dependson/DriverApplication.java diff --git a/spring-core/src/main/java/com/baeldung/dependson/config/Config.java b/spring-di/src/main/java/com/baeldung/dependson/config/Config.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependson/config/Config.java rename to spring-di/src/main/java/com/baeldung/dependson/config/Config.java diff --git a/spring-core/src/main/java/com/baeldung/dependson/file/processor/FileProcessor.java b/spring-di/src/main/java/com/baeldung/dependson/file/processor/FileProcessor.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependson/file/processor/FileProcessor.java rename to spring-di/src/main/java/com/baeldung/dependson/file/processor/FileProcessor.java diff --git a/spring-core/src/main/java/com/baeldung/dependson/file/reader/FileReader.java b/spring-di/src/main/java/com/baeldung/dependson/file/reader/FileReader.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependson/file/reader/FileReader.java rename to spring-di/src/main/java/com/baeldung/dependson/file/reader/FileReader.java diff --git a/spring-core/src/main/java/com/baeldung/dependson/file/writer/FileWriter.java b/spring-di/src/main/java/com/baeldung/dependson/file/writer/FileWriter.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependson/file/writer/FileWriter.java rename to spring-di/src/main/java/com/baeldung/dependson/file/writer/FileWriter.java diff --git a/spring-core/src/main/java/com/baeldung/dependson/shared/File.java b/spring-di/src/main/java/com/baeldung/dependson/shared/File.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/dependson/shared/File.java rename to spring-di/src/main/java/com/baeldung/dependson/shared/File.java diff --git a/spring-core/src/main/java/com/baeldung/di/spring/Account.java b/spring-di/src/main/java/com/baeldung/di/spring/Account.java similarity index 94% rename from spring-core/src/main/java/com/baeldung/di/spring/Account.java rename to spring-di/src/main/java/com/baeldung/di/spring/Account.java index 6d9883bda5..e34f2864e5 100644 --- a/spring-core/src/main/java/com/baeldung/di/spring/Account.java +++ b/spring-di/src/main/java/com/baeldung/di/spring/Account.java @@ -1,27 +1,27 @@ -package com.baeldung.di.spring; - -import org.springframework.stereotype.Component; - -@Component -public class Account { - - private String accountNumber; - private String type; - - public String getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(String accountNumber) { - this.accountNumber = accountNumber; - } - - public String getType() { - return type; - } - - public void setType(String type) { - this.type = type; - } - -} +package com.baeldung.di.spring; + +import org.springframework.stereotype.Component; + +@Component +public class Account { + + private String accountNumber; + private String type; + + public String getAccountNumber() { + return accountNumber; + } + + public void setAccountNumber(String accountNumber) { + this.accountNumber = accountNumber; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/AccountService.java b/spring-di/src/main/java/com/baeldung/di/spring/AccountService.java similarity index 93% rename from spring-core/src/main/java/com/baeldung/di/spring/AccountService.java rename to spring-di/src/main/java/com/baeldung/di/spring/AccountService.java index 75ba6bb3eb..388c8c03db 100644 --- a/spring-core/src/main/java/com/baeldung/di/spring/AccountService.java +++ b/spring-di/src/main/java/com/baeldung/di/spring/AccountService.java @@ -1,5 +1,5 @@ -package com.baeldung.di.spring; - -public interface AccountService { - -} +package com.baeldung.di.spring; + +public interface AccountService { + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/AccountServiceImpl.java b/spring-di/src/main/java/com/baeldung/di/spring/AccountServiceImpl.java similarity index 95% rename from spring-core/src/main/java/com/baeldung/di/spring/AccountServiceImpl.java rename to spring-di/src/main/java/com/baeldung/di/spring/AccountServiceImpl.java index 4a4baf7d92..6a3e4619f3 100644 --- a/spring-core/src/main/java/com/baeldung/di/spring/AccountServiceImpl.java +++ b/spring-di/src/main/java/com/baeldung/di/spring/AccountServiceImpl.java @@ -1,8 +1,8 @@ -package com.baeldung.di.spring; - -import org.springframework.stereotype.Component; - -@Component -public class AccountServiceImpl implements AccountService { - -} +package com.baeldung.di.spring; + +import org.springframework.stereotype.Component; + +@Component +public class AccountServiceImpl implements AccountService { + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/AudioBookService.java b/spring-di/src/main/java/com/baeldung/di/spring/AudioBookService.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/di/spring/AudioBookService.java rename to spring-di/src/main/java/com/baeldung/di/spring/AudioBookService.java diff --git a/spring-core/src/main/java/com/baeldung/di/spring/AudioBookServiceImpl.java b/spring-di/src/main/java/com/baeldung/di/spring/AudioBookServiceImpl.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/di/spring/AudioBookServiceImpl.java rename to spring-di/src/main/java/com/baeldung/di/spring/AudioBookServiceImpl.java diff --git a/spring-core/src/main/java/com/baeldung/di/spring/AuthorService.java b/spring-di/src/main/java/com/baeldung/di/spring/AuthorService.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/di/spring/AuthorService.java rename to spring-di/src/main/java/com/baeldung/di/spring/AuthorService.java diff --git a/spring-core/src/main/java/com/baeldung/di/spring/AuthorServiceImpl.java b/spring-di/src/main/java/com/baeldung/di/spring/AuthorServiceImpl.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/di/spring/AuthorServiceImpl.java rename to spring-di/src/main/java/com/baeldung/di/spring/AuthorServiceImpl.java diff --git a/spring-core/src/main/java/com/baeldung/di/spring/BookService.java b/spring-di/src/main/java/com/baeldung/di/spring/BookService.java similarity index 93% rename from spring-core/src/main/java/com/baeldung/di/spring/BookService.java rename to spring-di/src/main/java/com/baeldung/di/spring/BookService.java index 8e693e687d..6b25137ced 100644 --- a/spring-core/src/main/java/com/baeldung/di/spring/BookService.java +++ b/spring-di/src/main/java/com/baeldung/di/spring/BookService.java @@ -1,5 +1,5 @@ -package com.baeldung.di.spring; - -public interface BookService { - -} +package com.baeldung.di.spring; + +public interface BookService { + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/BookServiceImpl.java b/spring-di/src/main/java/com/baeldung/di/spring/BookServiceImpl.java similarity index 95% rename from spring-core/src/main/java/com/baeldung/di/spring/BookServiceImpl.java rename to spring-di/src/main/java/com/baeldung/di/spring/BookServiceImpl.java index b4ea602234..7cbb7e9b89 100644 --- a/spring-core/src/main/java/com/baeldung/di/spring/BookServiceImpl.java +++ b/spring-di/src/main/java/com/baeldung/di/spring/BookServiceImpl.java @@ -1,10 +1,10 @@ -package com.baeldung.di.spring; - -import org.springframework.beans.factory.annotation.Autowired; - -public class BookServiceImpl implements BookService { - - @Autowired(required = false) - private AuthorService authorService; - -} +package com.baeldung.di.spring; + +import org.springframework.beans.factory.annotation.Autowired; + +public class BookServiceImpl implements BookService { + + @Autowired(required = false) + private AuthorService authorService; + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/Foo.java b/spring-di/src/main/java/com/baeldung/di/spring/Foo.java similarity index 93% rename from spring-core/src/main/java/com/baeldung/di/spring/Foo.java rename to spring-di/src/main/java/com/baeldung/di/spring/Foo.java index 9d9b5d0888..6b2ba9b602 100644 --- a/spring-core/src/main/java/com/baeldung/di/spring/Foo.java +++ b/spring-di/src/main/java/com/baeldung/di/spring/Foo.java @@ -1,4 +1,4 @@ -package com.baeldung.di.spring; - -public class Foo { -} +package com.baeldung.di.spring; + +public class Foo { +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/FooProcessor.java b/spring-di/src/main/java/com/baeldung/di/spring/FooProcessor.java similarity index 94% rename from spring-core/src/main/java/com/baeldung/di/spring/FooProcessor.java rename to spring-di/src/main/java/com/baeldung/di/spring/FooProcessor.java index 9baaaef7a3..74f4d3a92b 100644 --- a/spring-core/src/main/java/com/baeldung/di/spring/FooProcessor.java +++ b/spring-di/src/main/java/com/baeldung/di/spring/FooProcessor.java @@ -1,6 +1,6 @@ -package com.baeldung.di.spring; - -public class FooProcessor { - - private Foo foo; +package com.baeldung.di.spring; + +public class FooProcessor { + + private Foo foo; } \ No newline at end of file diff --git a/spring-core/src/main/java/com/baeldung/di/spring/IService.java b/spring-di/src/main/java/com/baeldung/di/spring/IService.java similarity index 94% rename from spring-core/src/main/java/com/baeldung/di/spring/IService.java rename to spring-di/src/main/java/com/baeldung/di/spring/IService.java index 478eea0657..8c27f91589 100644 --- a/spring-core/src/main/java/com/baeldung/di/spring/IService.java +++ b/spring-di/src/main/java/com/baeldung/di/spring/IService.java @@ -1,5 +1,5 @@ -package com.baeldung.di.spring; - -public interface IService { - public String serve(); -} +package com.baeldung.di.spring; + +public interface IService { + public String serve(); +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/IndexApp.java b/spring-di/src/main/java/com/baeldung/di/spring/IndexApp.java similarity index 94% rename from spring-core/src/main/java/com/baeldung/di/spring/IndexApp.java rename to spring-di/src/main/java/com/baeldung/di/spring/IndexApp.java index a45970d6b2..d3ca2158cd 100644 --- a/spring-core/src/main/java/com/baeldung/di/spring/IndexApp.java +++ b/spring-di/src/main/java/com/baeldung/di/spring/IndexApp.java @@ -1,19 +1,19 @@ -package com.baeldung.di.spring; - -public class IndexApp { - - private IService service; - - public String getServiceValue() { - return service.serve(); - } - - public IService getService() { - return service; - } - - public void setService(IService service) { - this.service = service; - } - -} +package com.baeldung.di.spring; + +public class IndexApp { + + private IService service; + + public String getServiceValue() { + return service.serve(); + } + + public IService getService() { + return service; + } + + public void setService(IService service) { + this.service = service; + } + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/IndexService.java b/spring-di/src/main/java/com/baeldung/di/spring/IndexService.java similarity index 94% rename from spring-core/src/main/java/com/baeldung/di/spring/IndexService.java rename to spring-di/src/main/java/com/baeldung/di/spring/IndexService.java index ad241f5200..cbd4c28f3c 100644 --- a/spring-core/src/main/java/com/baeldung/di/spring/IndexService.java +++ b/spring-di/src/main/java/com/baeldung/di/spring/IndexService.java @@ -1,10 +1,10 @@ -package com.baeldung.di.spring; - -public class IndexService implements IService { - - @Override - public String serve() { - return "Hello World"; - } - -} +package com.baeldung.di.spring; + +public class IndexService implements IService { + + @Override + public String serve() { + return "Hello World"; + } + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/InstanceServiceFactory.java b/spring-di/src/main/java/com/baeldung/di/spring/InstanceServiceFactory.java similarity index 96% rename from spring-core/src/main/java/com/baeldung/di/spring/InstanceServiceFactory.java rename to spring-di/src/main/java/com/baeldung/di/spring/InstanceServiceFactory.java index f083504e8f..2cc7ff65ae 100644 --- a/spring-core/src/main/java/com/baeldung/di/spring/InstanceServiceFactory.java +++ b/spring-di/src/main/java/com/baeldung/di/spring/InstanceServiceFactory.java @@ -1,14 +1,14 @@ -package com.baeldung.di.spring; - -public class InstanceServiceFactory { - public IService getService(int number) { - switch (number) { - case 1: - return new MessageService("Foo"); - case 0: - return new IndexService(); - default: - throw new IllegalArgumentException("Unknown parameter " + number); - } - } -} +package com.baeldung.di.spring; + +public class InstanceServiceFactory { + public IService getService(int number) { + switch (number) { + case 1: + return new MessageService("Foo"); + case 0: + return new IndexService(); + default: + throw new IllegalArgumentException("Unknown parameter " + number); + } + } +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/MessageApp.java b/spring-di/src/main/java/com/baeldung/di/spring/MessageApp.java similarity index 94% rename from spring-core/src/main/java/com/baeldung/di/spring/MessageApp.java rename to spring-di/src/main/java/com/baeldung/di/spring/MessageApp.java index 1bf6c20b28..bb8188853a 100644 --- a/spring-core/src/main/java/com/baeldung/di/spring/MessageApp.java +++ b/spring-di/src/main/java/com/baeldung/di/spring/MessageApp.java @@ -1,14 +1,14 @@ -package com.baeldung.di.spring; - -public class MessageApp { - - private IService iService; - - public MessageApp(IService iService) { - this.iService = iService; - } - - public String getServiceValue() { - return iService.serve(); - } -} +package com.baeldung.di.spring; + +public class MessageApp { + + private IService iService; + + public MessageApp(IService iService) { + this.iService = iService; + } + + public String getServiceValue() { + return iService.serve(); + } +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/MessageService.java b/spring-di/src/main/java/com/baeldung/di/spring/MessageService.java similarity index 94% rename from spring-core/src/main/java/com/baeldung/di/spring/MessageService.java rename to spring-di/src/main/java/com/baeldung/di/spring/MessageService.java index 9b6efaab2a..1bb548bdf6 100644 --- a/spring-core/src/main/java/com/baeldung/di/spring/MessageService.java +++ b/spring-di/src/main/java/com/baeldung/di/spring/MessageService.java @@ -1,16 +1,16 @@ -package com.baeldung.di.spring; - -public class MessageService implements IService { - - private String message; - - public MessageService(String message) { - this.message = message; - } - - @Override - public String serve() { - return message; - } - -} +package com.baeldung.di.spring; + +public class MessageService implements IService { + + private String message; + + public MessageService(String message) { + this.message = message; + } + + @Override + public String serve() { + return message; + } + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/PersonDao.java b/spring-di/src/main/java/com/baeldung/di/spring/PersonDao.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/di/spring/PersonDao.java rename to spring-di/src/main/java/com/baeldung/di/spring/PersonDao.java diff --git a/spring-core/src/main/java/com/baeldung/di/spring/PersonDaoImpl.java b/spring-di/src/main/java/com/baeldung/di/spring/PersonDaoImpl.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/di/spring/PersonDaoImpl.java rename to spring-di/src/main/java/com/baeldung/di/spring/PersonDaoImpl.java diff --git a/spring-core/src/main/java/com/baeldung/di/spring/SpringBeansConfig.java b/spring-di/src/main/java/com/baeldung/di/spring/SpringBeansConfig.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/di/spring/SpringBeansConfig.java rename to spring-di/src/main/java/com/baeldung/di/spring/SpringBeansConfig.java diff --git a/spring-core/src/main/java/com/baeldung/di/spring/SpringMainConfig.java b/spring-di/src/main/java/com/baeldung/di/spring/SpringMainConfig.java similarity index 96% rename from spring-core/src/main/java/com/baeldung/di/spring/SpringMainConfig.java rename to spring-di/src/main/java/com/baeldung/di/spring/SpringMainConfig.java index 75066fd539..374a7e8e32 100644 --- a/spring-core/src/main/java/com/baeldung/di/spring/SpringMainConfig.java +++ b/spring-di/src/main/java/com/baeldung/di/spring/SpringMainConfig.java @@ -1,18 +1,18 @@ -package com.baeldung.di.spring; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; - -@Configuration -@Import({ SpringBeansConfig.class }) -@ComponentScan("com.baeldung.di.spring") -public class SpringMainConfig { - - @Bean - public BookService bookServiceGenerator() { - return new BookServiceImpl(); - } - -} +package com.baeldung.di.spring; + +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; + +@Configuration +@Import({ SpringBeansConfig.class }) +@ComponentScan("com.baeldung.di.spring") +public class SpringMainConfig { + + @Bean + public BookService bookServiceGenerator() { + return new BookServiceImpl(); + } + +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/SpringPersonService.java b/spring-di/src/main/java/com/baeldung/di/spring/SpringPersonService.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/di/spring/SpringPersonService.java rename to spring-di/src/main/java/com/baeldung/di/spring/SpringPersonService.java diff --git a/spring-core/src/main/java/com/baeldung/di/spring/StaticServiceFactory.java b/spring-di/src/main/java/com/baeldung/di/spring/StaticServiceFactory.java similarity index 96% rename from spring-core/src/main/java/com/baeldung/di/spring/StaticServiceFactory.java rename to spring-di/src/main/java/com/baeldung/di/spring/StaticServiceFactory.java index bd70898faf..6ef4c5e9ac 100644 --- a/spring-core/src/main/java/com/baeldung/di/spring/StaticServiceFactory.java +++ b/spring-di/src/main/java/com/baeldung/di/spring/StaticServiceFactory.java @@ -1,14 +1,14 @@ -package com.baeldung.di.spring; - -public class StaticServiceFactory { - public static IService getService(int number) { - switch (number) { - case 1: - return new MessageService("Foo"); - case 0: - return new IndexService(); - default: - throw new IllegalArgumentException("Unknown parameter " + number); - } - } -} +package com.baeldung.di.spring; + +public class StaticServiceFactory { + public static IService getService(int number) { + switch (number) { + case 1: + return new MessageService("Foo"); + case 0: + return new IndexService(); + default: + throw new IllegalArgumentException("Unknown parameter " + number); + } + } +} diff --git a/spring-core/src/main/java/com/baeldung/di/spring/UserService.java b/spring-di/src/main/java/com/baeldung/di/spring/UserService.java similarity index 95% rename from spring-core/src/main/java/com/baeldung/di/spring/UserService.java rename to spring-di/src/main/java/com/baeldung/di/spring/UserService.java index 330d7f7448..5ff35cda95 100644 --- a/spring-core/src/main/java/com/baeldung/di/spring/UserService.java +++ b/spring-di/src/main/java/com/baeldung/di/spring/UserService.java @@ -1,20 +1,20 @@ -package com.baeldung.di.spring; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class UserService { - - @Autowired - private AccountService accountService; - - public AccountService getAccountService() { - return accountService; - } - - public void setAccountService(AccountService accountService) { - this.accountService = accountService; - } - -} +package com.baeldung.di.spring; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +@Component +public class UserService { + + @Autowired + private AccountService accountService; + + public AccountService getAccountService() { + return accountService; + } + + public void setAccountService(AccountService accountService) { + this.accountService = accountService; + } + +} diff --git a/spring-di/src/main/java/com/baeldung/methodinjections/AppConfig.java b/spring-di/src/main/java/com/baeldung/methodinjections/AppConfig.java new file mode 100644 index 0000000000..7c1e209383 --- /dev/null +++ b/spring-di/src/main/java/com/baeldung/methodinjections/AppConfig.java @@ -0,0 +1,10 @@ +package com.baeldung.methodinjections; + +import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; + +@Configuration +@ComponentScan(basePackages = "com.baeldung.methodinjections") + +public class AppConfig { +} diff --git a/spring-di/src/main/java/com/baeldung/methodinjections/Grader.java b/spring-di/src/main/java/com/baeldung/methodinjections/Grader.java new file mode 100644 index 0000000000..10dc77484c --- /dev/null +++ b/spring-di/src/main/java/com/baeldung/methodinjections/Grader.java @@ -0,0 +1,19 @@ +package com.baeldung.methodinjections; + +import java.util.Collection; + +import org.springframework.stereotype.Component; + +@Component +public class Grader { + + public String grade(Collection marks) { + + boolean result = marks.stream() + .anyMatch(mark -> mark < 45); + if (result) { + return "FAIL"; + } + return "PASS"; + } +} diff --git a/spring-di/src/main/java/com/baeldung/methodinjections/SchoolNotification.java b/spring-di/src/main/java/com/baeldung/methodinjections/SchoolNotification.java new file mode 100644 index 0000000000..752eb8893f --- /dev/null +++ b/spring-di/src/main/java/com/baeldung/methodinjections/SchoolNotification.java @@ -0,0 +1,45 @@ +package com.baeldung.methodinjections; + +import java.util.ArrayList; +import java.util.Collection; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.config.ConfigurableBeanFactory; +import org.springframework.context.annotation.Scope; +import org.springframework.stereotype.Component; + +@Component("schoolNotification") +@Scope(ConfigurableBeanFactory.SCOPE_PROTOTYPE) +public class SchoolNotification { + @Autowired + Grader grader; + + private String name; + private Collection marks; + + public SchoolNotification(String name) { + this.name = name; + this.marks = new ArrayList(); + } + + public String addMark(Integer mark) { + this.marks.add(mark); + return this.grader.grade(this.marks); + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public Collection getMarks() { + return marks; + } + + public void setMarks(Collection marks) { + this.marks = marks; + } +} diff --git a/spring-di/src/main/java/com/baeldung/methodinjections/Student.java b/spring-di/src/main/java/com/baeldung/methodinjections/Student.java new file mode 100644 index 0000000000..ceeebc3d0d --- /dev/null +++ b/spring-di/src/main/java/com/baeldung/methodinjections/Student.java @@ -0,0 +1,27 @@ +package com.baeldung.methodinjections; + +import org.springframework.beans.factory.annotation.Lookup; +import org.springframework.stereotype.Component; + +@Component("studentBean") +public class Student { + + private String id; + + /** + * Injects a prototype bean SchoolNotification into Singleton student + */ + @Lookup + public SchoolNotification getNotification(String name) { + // spring overrides and returns a SchoolNotification instance + return null; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } +} diff --git a/spring-di/src/main/java/com/baeldung/methodinjections/StudentServices.java b/spring-di/src/main/java/com/baeldung/methodinjections/StudentServices.java new file mode 100644 index 0000000000..20d631b120 --- /dev/null +++ b/spring-di/src/main/java/com/baeldung/methodinjections/StudentServices.java @@ -0,0 +1,21 @@ +package com.baeldung.methodinjections; + +import java.util.HashMap; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Lookup; +import org.springframework.stereotype.Component; + +@Component("studentService") +public abstract class StudentServices { + + private Map notes = new HashMap<>(); + + @Lookup + protected abstract SchoolNotification getNotification(String name); + + public String appendMark(String name, Integer mark) { + SchoolNotification notification = notes.computeIfAbsent(name, exists -> getNotification(name)); + return notification.addMark(mark); + } +} diff --git a/spring-di/src/main/java/org/baeldung/sample/App.java b/spring-di/src/main/java/com/baeldung/sample/App.java similarity index 92% rename from spring-di/src/main/java/org/baeldung/sample/App.java rename to spring-di/src/main/java/com/baeldung/sample/App.java index 17fc49fc8c..f2a017f3e5 100644 --- a/spring-di/src/main/java/org/baeldung/sample/App.java +++ b/spring-di/src/main/java/com/baeldung/sample/App.java @@ -1,4 +1,4 @@ -package org.baeldung.sample; +package com.baeldung.sample; import org.springframework.context.annotation.AnnotationConfigApplicationContext; diff --git a/spring-di/src/main/java/org/baeldung/sample/AppConfig.java b/spring-di/src/main/java/com/baeldung/sample/AppConfig.java similarity index 87% rename from spring-di/src/main/java/org/baeldung/sample/AppConfig.java rename to spring-di/src/main/java/com/baeldung/sample/AppConfig.java index 8a177d2611..c948011c69 100644 --- a/spring-di/src/main/java/org/baeldung/sample/AppConfig.java +++ b/spring-di/src/main/java/com/baeldung/sample/AppConfig.java @@ -1,4 +1,4 @@ -package org.baeldung.sample; +package com.baeldung.sample; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; diff --git a/spring-di/src/main/java/com/baeldung/sample/Bar.java b/spring-di/src/main/java/com/baeldung/sample/Bar.java new file mode 100644 index 0000000000..42302b5563 --- /dev/null +++ b/spring-di/src/main/java/com/baeldung/sample/Bar.java @@ -0,0 +1,5 @@ +package com.baeldung.sample; + +public class Bar { + +} diff --git a/spring-di/src/main/java/org/baeldung/sample/BarFormatter.java b/spring-di/src/main/java/com/baeldung/sample/BarFormatter.java similarity index 86% rename from spring-di/src/main/java/org/baeldung/sample/BarFormatter.java rename to spring-di/src/main/java/com/baeldung/sample/BarFormatter.java index 8396653970..e3e0733627 100644 --- a/spring-di/src/main/java/org/baeldung/sample/BarFormatter.java +++ b/spring-di/src/main/java/com/baeldung/sample/BarFormatter.java @@ -1,4 +1,4 @@ -package org.baeldung.sample; +package com.baeldung.sample; import org.springframework.stereotype.Component; diff --git a/spring-di/src/main/java/com/baeldung/sample/Foo.java b/spring-di/src/main/java/com/baeldung/sample/Foo.java new file mode 100644 index 0000000000..b25c9ecfb5 --- /dev/null +++ b/spring-di/src/main/java/com/baeldung/sample/Foo.java @@ -0,0 +1,5 @@ +package com.baeldung.sample; + +public class Foo { + +} diff --git a/spring-di/src/main/java/com/baeldung/sample/FooDAO.java b/spring-di/src/main/java/com/baeldung/sample/FooDAO.java new file mode 100644 index 0000000000..cc8f732bf9 --- /dev/null +++ b/spring-di/src/main/java/com/baeldung/sample/FooDAO.java @@ -0,0 +1,5 @@ +package com.baeldung.sample; + +public class FooDAO { + +} diff --git a/spring-di/src/main/java/org/baeldung/sample/FooFormatter.java b/spring-di/src/main/java/com/baeldung/sample/FooFormatter.java similarity index 86% rename from spring-di/src/main/java/org/baeldung/sample/FooFormatter.java rename to spring-di/src/main/java/com/baeldung/sample/FooFormatter.java index 68cb7f81f2..25a0b9059d 100644 --- a/spring-di/src/main/java/org/baeldung/sample/FooFormatter.java +++ b/spring-di/src/main/java/com/baeldung/sample/FooFormatter.java @@ -1,4 +1,4 @@ -package org.baeldung.sample; +package com.baeldung.sample; import org.springframework.stereotype.Component; diff --git a/spring-di/src/main/java/org/baeldung/sample/FooService.java b/spring-di/src/main/java/com/baeldung/sample/FooService.java similarity index 91% rename from spring-di/src/main/java/org/baeldung/sample/FooService.java rename to spring-di/src/main/java/com/baeldung/sample/FooService.java index 711711f205..6d7ed3d93b 100644 --- a/spring-di/src/main/java/org/baeldung/sample/FooService.java +++ b/spring-di/src/main/java/com/baeldung/sample/FooService.java @@ -1,4 +1,4 @@ -package org.baeldung.sample; +package com.baeldung.sample; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; diff --git a/spring-di/src/main/java/org/baeldung/sample/Formatter.java b/spring-di/src/main/java/com/baeldung/sample/Formatter.java similarity index 65% rename from spring-di/src/main/java/org/baeldung/sample/Formatter.java rename to spring-di/src/main/java/com/baeldung/sample/Formatter.java index ab29c2b848..c5de59993c 100644 --- a/spring-di/src/main/java/org/baeldung/sample/Formatter.java +++ b/spring-di/src/main/java/com/baeldung/sample/Formatter.java @@ -1,4 +1,4 @@ -package org.baeldung.sample; +package com.baeldung.sample; public interface Formatter { diff --git a/spring-di/src/main/java/org/baeldung/sample/FormatterType.java b/spring-di/src/main/java/com/baeldung/sample/FormatterType.java similarity index 93% rename from spring-di/src/main/java/org/baeldung/sample/FormatterType.java rename to spring-di/src/main/java/com/baeldung/sample/FormatterType.java index a00a9750bf..1ac6c6f4ad 100644 --- a/spring-di/src/main/java/org/baeldung/sample/FormatterType.java +++ b/spring-di/src/main/java/com/baeldung/sample/FormatterType.java @@ -1,4 +1,4 @@ -package org.baeldung.sample; +package com.baeldung.sample; import org.springframework.beans.factory.annotation.Qualifier; diff --git a/spring-di/src/main/java/org/baeldung/sample/Bar.java b/spring-di/src/main/java/org/baeldung/sample/Bar.java deleted file mode 100644 index 54e8d54418..0000000000 --- a/spring-di/src/main/java/org/baeldung/sample/Bar.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.sample; - -public class Bar { - -} diff --git a/spring-di/src/main/java/org/baeldung/sample/Foo.java b/spring-di/src/main/java/org/baeldung/sample/Foo.java deleted file mode 100644 index 562a00121a..0000000000 --- a/spring-di/src/main/java/org/baeldung/sample/Foo.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.sample; - -public class Foo { - -} diff --git a/spring-di/src/main/java/org/baeldung/sample/FooDAO.java b/spring-di/src/main/java/org/baeldung/sample/FooDAO.java deleted file mode 100644 index 151c0c38de..0000000000 --- a/spring-di/src/main/java/org/baeldung/sample/FooDAO.java +++ /dev/null @@ -1,5 +0,0 @@ -package org.baeldung.sample; - -public class FooDAO { - -} diff --git a/spring-di/src/main/resources/application.properties b/spring-di/src/main/resources/application.properties new file mode 100644 index 0000000000..11710b49aa --- /dev/null +++ b/spring-di/src/main/resources/application.properties @@ -0,0 +1,2 @@ +spring.profiles.active=prod + diff --git a/spring-di/src/main/resources/baeldung.xml b/spring-di/src/main/resources/baeldung.xml new file mode 100644 index 0000000000..d84492f1d4 --- /dev/null +++ b/spring-di/src/main/resources/baeldung.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + diff --git a/spring-di/src/main/resources/beaninjectiontypes-context.xml b/spring-di/src/main/resources/beaninjectiontypes-context.xml new file mode 100644 index 0000000000..dfdea41cdc --- /dev/null +++ b/spring-di/src/main/resources/beaninjectiontypes-context.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-di/src/main/resources/beans.xml b/spring-di/src/main/resources/beans.xml new file mode 100644 index 0000000000..4002fa63bd --- /dev/null +++ b/spring-di/src/main/resources/beans.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/spring-di/src/main/resources/classpathxmlapplicationcontext-example.xml b/spring-di/src/main/resources/classpathxmlapplicationcontext-example.xml new file mode 100644 index 0000000000..d0ba03cec8 --- /dev/null +++ b/spring-di/src/main/resources/classpathxmlapplicationcontext-example.xml @@ -0,0 +1,18 @@ + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-di/src/main/resources/classpathxmlapplicationcontext-internationalization.xml b/spring-di/src/main/resources/classpathxmlapplicationcontext-internationalization.xml new file mode 100644 index 0000000000..f68d623be7 --- /dev/null +++ b/spring-di/src/main/resources/classpathxmlapplicationcontext-internationalization.xml @@ -0,0 +1,14 @@ + + + + + + + dialog/dialog + + + + \ No newline at end of file diff --git a/spring-di/src/main/resources/com.baeldung.di.spring.properties b/spring-di/src/main/resources/com.baeldung.di.spring.properties new file mode 100644 index 0000000000..8b8b5b85c2 --- /dev/null +++ b/spring-di/src/main/resources/com.baeldung.di.spring.properties @@ -0,0 +1 @@ +message.value=Hello World \ No newline at end of file diff --git a/spring-di/src/main/resources/com.baeldung.di.spring.xml b/spring-di/src/main/resources/com.baeldung.di.spring.xml new file mode 100644 index 0000000000..81942453b2 --- /dev/null +++ b/spring-di/src/main/resources/com.baeldung.di.spring.xml @@ -0,0 +1,43 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-di/src/main/resources/constructordi.xml b/spring-di/src/main/resources/constructordi.xml new file mode 100644 index 0000000000..08f6013dc6 --- /dev/null +++ b/spring-di/src/main/resources/constructordi.xml @@ -0,0 +1,22 @@ + + + + + + + + + + + + + + + + + diff --git a/spring-di/src/main/resources/dependencyinjectiontypes-context.xml b/spring-di/src/main/resources/dependencyinjectiontypes-context.xml new file mode 100644 index 0000000000..bd6b3c408d --- /dev/null +++ b/spring-di/src/main/resources/dependencyinjectiontypes-context.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-di/src/main/resources/dialog/dialog_en.properties b/spring-di/src/main/resources/dialog/dialog_en.properties new file mode 100644 index 0000000000..cf65b8990e --- /dev/null +++ b/spring-di/src/main/resources/dialog/dialog_en.properties @@ -0,0 +1,3 @@ +hello=hello +you=you +thanks=thank {0} \ No newline at end of file diff --git a/spring-di/src/main/resources/dialog/dialog_zh_CN.properties b/spring-di/src/main/resources/dialog/dialog_zh_CN.properties new file mode 100644 index 0000000000..ab09c8b39f --- /dev/null +++ b/spring-di/src/main/resources/dialog/dialog_zh_CN.properties @@ -0,0 +1,3 @@ +hello=\u4f60\u597d +you=\u4f60 +thanks=\u8c22\u8c22{0} \ No newline at end of file diff --git a/spring-di/src/main/resources/factorybean-abstract-spring-ctx.xml b/spring-di/src/main/resources/factorybean-abstract-spring-ctx.xml new file mode 100644 index 0000000000..a82b884ee5 --- /dev/null +++ b/spring-di/src/main/resources/factorybean-abstract-spring-ctx.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-di/src/main/resources/factorybean-spring-ctx.xml b/spring-di/src/main/resources/factorybean-spring-ctx.xml new file mode 100644 index 0000000000..3231fda676 --- /dev/null +++ b/spring-di/src/main/resources/factorybean-spring-ctx.xml @@ -0,0 +1,10 @@ + + + + + + + + \ No newline at end of file diff --git a/spring-di/src/main/resources/injectiontypes.xml b/spring-di/src/main/resources/injectiontypes.xml new file mode 100644 index 0000000000..9dad1e300a --- /dev/null +++ b/spring-di/src/main/resources/injectiontypes.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + \ No newline at end of file diff --git a/spring-di/src/main/resources/logback.xml b/spring-di/src/main/resources/logback.xml new file mode 100644 index 0000000000..7d900d8ea8 --- /dev/null +++ b/spring-di/src/main/resources/logback.xml @@ -0,0 +1,13 @@ + + + + + %d{HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n + + + + + + + + \ No newline at end of file diff --git a/spring-di/src/main/resources/setterdi.xml b/spring-di/src/main/resources/setterdi.xml new file mode 100644 index 0000000000..cf3b00d7f5 --- /dev/null +++ b/spring-di/src/main/resources/setterdi.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/spring-core/src/test/java/com/baeldung/autowired/FieldAutowiredIntegrationTest.java b/spring-di/src/test/java/com/baeldung/autowired/FieldAutowiredIntegrationTest.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/autowired/FieldAutowiredIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/autowired/FieldAutowiredIntegrationTest.java diff --git a/spring-core/src/test/java/com/baeldung/autowired/FieldAutowiredNameIntegrationTest.java b/spring-di/src/test/java/com/baeldung/autowired/FieldAutowiredNameIntegrationTest.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/autowired/FieldAutowiredNameIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/autowired/FieldAutowiredNameIntegrationTest.java diff --git a/spring-core/src/test/java/com/baeldung/autowired/FieldQualifierAutowiredIntegrationTest.java b/spring-di/src/test/java/com/baeldung/autowired/FieldQualifierAutowiredIntegrationTest.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/autowired/FieldQualifierAutowiredIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/autowired/FieldQualifierAutowiredIntegrationTest.java diff --git a/spring-core/src/test/java/com/baeldung/circulardependency/CircularDependencyIntegrationTest.java b/spring-di/src/test/java/com/baeldung/circulardependency/CircularDependencyIntegrationTest.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/circulardependency/CircularDependencyIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/circulardependency/CircularDependencyIntegrationTest.java diff --git a/spring-core/src/test/java/com/baeldung/circulardependency/TestConfig.java b/spring-di/src/test/java/com/baeldung/circulardependency/TestConfig.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/circulardependency/TestConfig.java rename to spring-di/src/test/java/com/baeldung/circulardependency/TestConfig.java diff --git a/spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestAutowiredName.java b/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredName.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestAutowiredName.java rename to spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredName.java diff --git a/spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestAutowiredQualifier.java b/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredQualifier.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestAutowiredQualifier.java rename to spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredQualifier.java diff --git a/spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestAutowiredType.java b/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredType.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestAutowiredType.java rename to spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestAutowiredType.java diff --git a/spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestInjectName.java b/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectName.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestInjectName.java rename to spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectName.java diff --git a/spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestInjectQualifier.java b/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectQualifier.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestInjectQualifier.java rename to spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectQualifier.java diff --git a/spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestInjectType.java b/spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectType.java similarity index 100% rename from spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestInjectType.java rename to spring-di/src/test/java/com/baeldung/configuration/ApplicationContextTestInjectType.java diff --git a/spring-core/src/test/java/com/baeldung/constructordi/ConstructorDependencyInjectionIntegrationTest.java b/spring-di/src/test/java/com/baeldung/constructordi/ConstructorDependencyInjectionIntegrationTest.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/constructordi/ConstructorDependencyInjectionIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/constructordi/ConstructorDependencyInjectionIntegrationTest.java diff --git a/spring-core/src/test/java/com/baeldung/dependencyinjectiontypes/DependencyInjectionIntegrationTest.java b/spring-di/src/test/java/com/baeldung/dependencyinjectiontypes/DependencyInjectionIntegrationTest.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/dependencyinjectiontypes/DependencyInjectionIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/dependencyinjectiontypes/DependencyInjectionIntegrationTest.java diff --git a/spring-core/src/test/java/com/baeldung/dependson/config/TestConfig.java b/spring-di/src/test/java/com/baeldung/dependson/config/TestConfig.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/dependson/config/TestConfig.java rename to spring-di/src/test/java/com/baeldung/dependson/config/TestConfig.java diff --git a/spring-core/src/test/java/com/baeldung/dependson/processor/FileProcessorIntegrationTest.java b/spring-di/src/test/java/com/baeldung/dependson/processor/FileProcessorIntegrationTest.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/dependson/processor/FileProcessorIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/dependson/processor/FileProcessorIntegrationTest.java diff --git a/spring-core/src/test/java/com/baeldung/di/spring/BeanInjectionIntegrationTest.java b/spring-di/src/test/java/com/baeldung/di/spring/BeanInjectionIntegrationTest.java similarity index 96% rename from spring-core/src/test/java/com/baeldung/di/spring/BeanInjectionIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/di/spring/BeanInjectionIntegrationTest.java index 4bfb3c5de4..b0c566e4d7 100644 --- a/spring-core/src/test/java/com/baeldung/di/spring/BeanInjectionIntegrationTest.java +++ b/spring-di/src/test/java/com/baeldung/di/spring/BeanInjectionIntegrationTest.java @@ -1,31 +1,31 @@ -package com.baeldung.di.spring; - -import static org.junit.Assert.*; -import org.junit.Before; -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class BeanInjectionIntegrationTest { - - private ApplicationContext applicationContext; - - @Before - public void setUp() throws Exception { - applicationContext = new ClassPathXmlApplicationContext("com.baeldung.di.spring.xml"); - } - - @Test - public void singletonBean_getBean_returnsSingleInstance() { - final IndexApp indexApp1 = applicationContext.getBean("indexApp", IndexApp.class); - final IndexApp indexApp2 = applicationContext.getBean("indexApp", IndexApp.class); - assertEquals(indexApp1, indexApp2); - } - - @Test - public void getBean_returnsInstance() { - final IndexApp indexApp = applicationContext.getBean("indexApp", IndexApp.class); - assertNotNull(indexApp); - } - -} +package com.baeldung.di.spring; + +import static org.junit.Assert.*; +import org.junit.Before; +import org.junit.Test; +import org.springframework.context.ApplicationContext; +import org.springframework.context.support.ClassPathXmlApplicationContext; + +public class BeanInjectionIntegrationTest { + + private ApplicationContext applicationContext; + + @Before + public void setUp() throws Exception { + applicationContext = new ClassPathXmlApplicationContext("com.baeldung.di.spring.xml"); + } + + @Test + public void singletonBean_getBean_returnsSingleInstance() { + final IndexApp indexApp1 = applicationContext.getBean("indexApp", IndexApp.class); + final IndexApp indexApp2 = applicationContext.getBean("indexApp", IndexApp.class); + assertEquals(indexApp1, indexApp2); + } + + @Test + public void getBean_returnsInstance() { + final IndexApp indexApp = applicationContext.getBean("indexApp", IndexApp.class); + assertNotNull(indexApp); + } + +} diff --git a/spring-core/src/test/java/com/baeldung/di/spring/SpringUnitTest.java b/spring-di/src/test/java/com/baeldung/di/spring/SpringUnitTest.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/di/spring/SpringUnitTest.java rename to spring-di/src/test/java/com/baeldung/di/spring/SpringUnitTest.java diff --git a/spring-core/src/test/java/com/baeldung/inject/FieldByNameInjectIntegrationTest.java b/spring-di/src/test/java/com/baeldung/inject/FieldByNameInjectIntegrationTest.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/inject/FieldByNameInjectIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/inject/FieldByNameInjectIntegrationTest.java diff --git a/spring-core/src/test/java/com/baeldung/inject/FieldInjectIntegrationTest.java b/spring-di/src/test/java/com/baeldung/inject/FieldInjectIntegrationTest.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/inject/FieldInjectIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/inject/FieldInjectIntegrationTest.java diff --git a/spring-core/src/test/java/com/baeldung/inject/FieldQualifierInjectIntegrationTest.java b/spring-di/src/test/java/com/baeldung/inject/FieldQualifierInjectIntegrationTest.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/inject/FieldQualifierInjectIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/inject/FieldQualifierInjectIntegrationTest.java diff --git a/spring-core/src/test/java/com/baeldung/methodinjections/StudentIntegrationTest.java b/spring-di/src/test/java/com/baeldung/methodinjections/StudentIntegrationTest.java similarity index 100% rename from spring-core/src/test/java/com/baeldung/methodinjections/StudentIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/methodinjections/StudentIntegrationTest.java diff --git a/spring-di/src/test/java/org/baeldung/sample/FooServiceIntegrationTest.java b/spring-di/src/test/java/com/baeldung/sample/FooServiceIntegrationTest.java similarity index 96% rename from spring-di/src/test/java/org/baeldung/sample/FooServiceIntegrationTest.java rename to spring-di/src/test/java/com/baeldung/sample/FooServiceIntegrationTest.java index 6b518395a1..d42b98fc76 100644 --- a/spring-di/src/test/java/org/baeldung/sample/FooServiceIntegrationTest.java +++ b/spring-di/src/test/java/com/baeldung/sample/FooServiceIntegrationTest.java @@ -1,4 +1,4 @@ -package org.baeldung.sample; +package com.baeldung.sample; import org.junit.Assert; import org.junit.Test; diff --git a/spring-di/src/test/resources/beanfactory-example.xml b/spring-di/src/test/resources/beanfactory-example.xml new file mode 100644 index 0000000000..7b3d4f29ed --- /dev/null +++ b/spring-di/src/test/resources/beanfactory-example.xml @@ -0,0 +1,13 @@ + + + + + + + + + + \ No newline at end of file diff --git a/spring-di/src/test/resources/data/employees.dat b/spring-di/src/test/resources/data/employees.dat new file mode 100644 index 0000000000..9c28fdf82f --- /dev/null +++ b/spring-di/src/test/resources/data/employees.dat @@ -0,0 +1 @@ +Joe Employee,Jan Employee,James T. Employee \ No newline at end of file diff --git a/spring-di/src/test/resources/input.txt b/spring-di/src/test/resources/input.txt new file mode 100644 index 0000000000..811232fa1f --- /dev/null +++ b/spring-di/src/test/resources/input.txt @@ -0,0 +1 @@ +This file is merely for testing. \ No newline at end of file diff --git a/spring-di/src/test/resources/output.txt b/spring-di/src/test/resources/output.txt new file mode 100644 index 0000000000..34e1e27d5a --- /dev/null +++ b/spring-di/src/test/resources/output.txt @@ -0,0 +1 @@ +Should be copied to OutputStream. \ No newline at end of file