diff --git a/pom.xml b/pom.xml index b5dee350ca..f2dd0ae48c 100644 --- a/pom.xml +++ b/pom.xml @@ -212,7 +212,6 @@ spring-spel spring-state-machine spring-thymeleaf - spring-types-bean-injection spring-userservice spring-zuul spring-reactor diff --git a/spring-types-bean-injection/README.md b/spring-types-bean-injection/README.md deleted file mode 100644 index 45f8216849..0000000000 --- a/spring-types-bean-injection/README.md +++ /dev/null @@ -1,3 +0,0 @@ -## Relevant articles: - -- [Constructor Dependency Injection in Spring](http://www.baeldung.com/constructor-injection-in-spring) \ No newline at end of file diff --git a/spring-types-bean-injection/pom.xml b/spring-types-bean-injection/pom.xml deleted file mode 100644 index 75fee65d80..0000000000 --- a/spring-types-bean-injection/pom.xml +++ /dev/null @@ -1,81 +0,0 @@ - - - 4.0.0 - - com.baeldung - spring-types-bean-injection - 0.0.1-SNAPSHOT - jar - - spring-types-bean-injection - Types of bean injection in spring - - - com.baeldung - parent-modules - 1.0.0-SNAPSHOT - - - - - org.springframework - spring-context - ${spring.version} - - - org.springframework - spring-test - ${spring.version} - test - - - junit - junit - ${junit.version} - test - - - - - - integration - - - - org.apache.maven.plugins - maven-surefire-plugin - - - integration-test - - test - - - - **/*LiveTest.java - - - **/*IntegrationTest.java - - - - - - - json - - - - - - - - - - 1.8 - 4.3.10.RELEASE - 4.12 - - - diff --git a/spring-types-bean-injection/src/main/java/com/baeldung/config/AppConfig.java b/spring-types-bean-injection/src/main/java/com/baeldung/config/AppConfig.java deleted file mode 100644 index 45be32fa06..0000000000 --- a/spring-types-bean-injection/src/main/java/com/baeldung/config/AppConfig.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.config; - -import com.baeldung.service.MegaTestService; -import com.baeldung.service.SuperTestService; -import com.baeldung.service.TestService; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; - -@Configuration -public class AppConfig { - @Bean - public TestService TestService() { - return new TestService(); - } - - @Bean - public SuperTestService SuperTestService() { - return new SuperTestService(new TestService()); - } - - @Bean - public MegaTestService MegaTestService() { - return new MegaTestService(); - } -} diff --git a/spring-types-bean-injection/src/main/java/com/baeldung/service/MegaTestService.java b/spring-types-bean-injection/src/main/java/com/baeldung/service/MegaTestService.java deleted file mode 100644 index 45deeb8592..0000000000 --- a/spring-types-bean-injection/src/main/java/com/baeldung/service/MegaTestService.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class MegaTestService { - private TestService testService; - - @Autowired - public void setTestService(TestService testService) { - this.testService = testService; - } - - public String getMegaTestOne() { - return "Mega" + testService.getTestOne(); - } - - public String getMegaTestTwo() { - return "Mega" + testService.getTestTwo(); - } -} diff --git a/spring-types-bean-injection/src/main/java/com/baeldung/service/SuperTestService.java b/spring-types-bean-injection/src/main/java/com/baeldung/service/SuperTestService.java deleted file mode 100644 index edf1f2b1c5..0000000000 --- a/spring-types-bean-injection/src/main/java/com/baeldung/service/SuperTestService.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.service; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Service; - -@Service -public class SuperTestService { - private TestService testService; - - @Autowired - public SuperTestService(TestService testService) { - this.testService = testService; - } - - public String getSuperTestOne() { - return "Super" + testService.getTestOne(); - } - - public String getSuperTestTwo() { - return "Super" + testService.getTestTwo(); - } -} diff --git a/spring-types-bean-injection/src/main/java/com/baeldung/service/TestService.java b/spring-types-bean-injection/src/main/java/com/baeldung/service/TestService.java deleted file mode 100644 index 3e7c327dbd..0000000000 --- a/spring-types-bean-injection/src/main/java/com/baeldung/service/TestService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.service; - -import org.springframework.stereotype.Service; - -@Service -public class TestService { - public String getTestOne() { - return "TestOne"; - } - - public String getTestTwo() { - return "TestTwo"; - } -} diff --git a/spring-types-bean-injection/src/test/java/com/baeldung/service/MegaTestServiceIntegrationTest.java b/spring-types-bean-injection/src/test/java/com/baeldung/service/MegaTestServiceIntegrationTest.java deleted file mode 100644 index ced897c70c..0000000000 --- a/spring-types-bean-injection/src/test/java/com/baeldung/service/MegaTestServiceIntegrationTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.service; - -import com.baeldung.config.AppConfig; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -import static org.hamcrest.CoreMatchers.is; - -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = {AppConfig.class}) -public class MegaTestServiceIntegrationTest { - @Autowired - MegaTestService megaTestService; - - @Test - public void whenCallingGetMegaTestOne_thenWeGetMegaTestOneString() { - String resultOne = megaTestService.getMegaTestOne(); - - Assert.assertThat(resultOne, is("MegaTestOne")); - } - - @Test - public void whenCallingGetMegaTestTwo_thenWeGetMegaTestTwoString() { - String resultTwo = megaTestService.getMegaTestTwo(); - - Assert.assertThat(resultTwo, is("MegaTestTwo")); - } -} diff --git a/spring-types-bean-injection/src/test/java/com/baeldung/service/SuperTestServiceIntegrationTest.java b/spring-types-bean-injection/src/test/java/com/baeldung/service/SuperTestServiceIntegrationTest.java deleted file mode 100644 index a037d70c40..0000000000 --- a/spring-types-bean-injection/src/test/java/com/baeldung/service/SuperTestServiceIntegrationTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.service; - -import com.baeldung.config.AppConfig; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -import static org.hamcrest.CoreMatchers.is; - -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = {AppConfig.class}) -public class SuperTestServiceIntegrationTest { - @Autowired - SuperTestService superTestService; - - @Test - public void whenCallingGetSuperTestOne_thenWeGetSuperTestOneString() { - String resultOne = superTestService.getSuperTestOne(); - - Assert.assertThat(resultOne, is("SuperTestOne")); - } - - @Test - public void whenCallingGetSuperTestTwo_thenWeGetSuperTestTwoString() { - String resultTwo = superTestService.getSuperTestTwo(); - - Assert.assertThat(resultTwo, is("SuperTestTwo")); - } -} diff --git a/spring-types-bean-injection/src/test/java/com/baeldung/service/TestServiceIntegrationTest.java b/spring-types-bean-injection/src/test/java/com/baeldung/service/TestServiceIntegrationTest.java deleted file mode 100644 index 2059e87e04..0000000000 --- a/spring-types-bean-injection/src/test/java/com/baeldung/service/TestServiceIntegrationTest.java +++ /dev/null @@ -1,32 +0,0 @@ -package com.baeldung.service; - -import com.baeldung.config.AppConfig; -import org.junit.Assert; -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringRunner; - -import static org.hamcrest.CoreMatchers.is; - -@RunWith(SpringRunner.class) -@ContextConfiguration(classes = { AppConfig.class }) -public class TestServiceIntegrationTest { - @Autowired - TestService testService; - - @Test - public void whenCallingGetTestOne_thenWeGetTestOneString() { - String resultOne = testService.getTestOne(); - - Assert.assertThat(resultOne, is("TestOne")); - } - - @Test - public void whenCallingGetTestTwo_thenWeGetTestTwoString() { - String resultTwo = testService.getTestTwo(); - - Assert.assertThat(resultTwo, is("TestTwo")); - } -} \ No newline at end of file