diff --git a/core-java/src/main/java/com/baeldung/stream/StreamApi.java b/core-java/src/main/java/com/baeldung/stream/StreamApi.java index ec792314d2..364fdeffbb 100644 --- a/core-java/src/main/java/com/baeldung/stream/StreamApi.java +++ b/core-java/src/main/java/com/baeldung/stream/StreamApi.java @@ -5,17 +5,17 @@ import java.util.stream.Stream; public class StreamApi { - public String getLastElementUsingReduce(List valueList) { + public static String getLastElementUsingReduce(List valueList) { Stream stream = valueList.stream(); return stream.reduce((first, second) -> second).orElse(null); } - public Integer getInfiniteStreamLastElementUsingReduce() { + public static Integer getInfiniteStreamLastElementUsingReduce() { Stream stream = Stream.iterate(0, i -> i + 1); return stream.limit(20).reduce((first, second) -> second).orElse(null); } - public String getLastElementUsingSkip(List valueList) { + public static String getLastElementUsingSkip(List valueList) { long count = valueList.stream().count(); Stream stream = valueList.stream(); return stream.skip(count - 1).findFirst().orElse(null); diff --git a/core-java/src/test/java/com/baeldung/stream/StreamApiTest.java b/core-java/src/test/java/com/baeldung/stream/StreamApiTest.java index af52b3ee69..68b5fc83a5 100644 --- a/core-java/src/test/java/com/baeldung/stream/StreamApiTest.java +++ b/core-java/src/test/java/com/baeldung/stream/StreamApiTest.java @@ -1,41 +1,40 @@ package com.baeldung.stream; -import static org.junit.Assert.assertEquals; +import org.junit.Test; import java.util.ArrayList; import java.util.List; -import org.junit.Test; +import static org.junit.Assert.assertEquals; public class StreamApiTest { - private StreamApi streamApi = new StreamApi(); @Test public void givenList_whenGetLastElementUsingReduce_thenReturnLastElement() { - List valueList = new ArrayList(); + List valueList = new ArrayList<>(); valueList.add("Joe"); valueList.add("John"); valueList.add("Sean"); - String last = streamApi.getLastElementUsingReduce(valueList); + String last = StreamApi.getLastElementUsingReduce(valueList); assertEquals("Sean", last); } @Test public void givenInfiniteStream_whenGetInfiniteStreamLastElementUsingReduce_thenReturnLastElement() { - Integer last = streamApi.getInfiniteStreamLastElementUsingReduce(); - assertEquals(new Integer(19), last); + int last = StreamApi.getInfiniteStreamLastElementUsingReduce(); + assertEquals(19, last); } @Test public void givenListAndCount_whenGetLastElementUsingSkip_thenReturnLastElement() { - List valueList = new ArrayList(); + List valueList = new ArrayList<>(); valueList.add("Joe"); valueList.add("John"); valueList.add("Sean"); - String last = streamApi.getLastElementUsingSkip(valueList); + String last = StreamApi.getLastElementUsingSkip(valueList); assertEquals("Sean", last); } diff --git a/spring-core/src/main/java/com/baeldung/beaninjection/AnotherSampleDAOBean.java b/spring-core/src/main/java/com/baeldung/beaninjection/AnotherSampleDAOBean.java deleted file mode 100644 index 6313ba5a65..0000000000 --- a/spring-core/src/main/java/com/baeldung/beaninjection/AnotherSampleDAOBean.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.beaninjection; - -public class AnotherSampleDAOBean implements IAnotherSampleDAO { - - private String propertyY; - - public AnotherSampleDAOBean(String propertyY) { - this.propertyY = propertyY; - } - - // standard setters and getters - - public String getPropertyY() { - return propertyY; - } - -} diff --git a/spring-core/src/main/java/com/baeldung/beaninjection/ExampleDAOBean.java b/spring-core/src/main/java/com/baeldung/beaninjection/ExampleDAOBean.java deleted file mode 100644 index cbc7b35a7c..0000000000 --- a/spring-core/src/main/java/com/baeldung/beaninjection/ExampleDAOBean.java +++ /dev/null @@ -1,39 +0,0 @@ -package com.baeldung.beaninjection; - -import java.util.List; - -public class ExampleDAOBean implements IExampleDAO { - - private String propertyX; - - public ExampleDAOBean(String propertyX) { - this.propertyX = propertyX; - } - - public String getPropertyX() { - return propertyX; - } - - public void setPropertyX(String propertyX) { - this.propertyX = propertyX; - } - - @Override - public List getDomainList() { - // TODO Auto-generated method stub - return null; - } - - @Override - public SampleDomainObject createNewDomain(SampleDomainObject inputDomain) { - // TODO Auto-generated method stub - return null; - } - - @Override - public SampleDomainObject getSomeDomain() { - // TODO Auto-generated method stub - return new SampleDomainObject(); - } - -} diff --git a/spring-core/src/main/java/com/baeldung/beaninjection/ExampleServiceBean.java b/spring-core/src/main/java/com/baeldung/beaninjection/ExampleServiceBean.java deleted file mode 100644 index e5a5dfff5d..0000000000 --- a/spring-core/src/main/java/com/baeldung/beaninjection/ExampleServiceBean.java +++ /dev/null @@ -1,47 +0,0 @@ -package com.baeldung.beaninjection; - -import java.util.List; - -public class ExampleServiceBean implements IExampleService { - - private IExampleDAO exampleDAO; - private IAnotherSampleDAO anotherSampleDAO; - - public ExampleServiceBean(IExampleDAO exampleDAO) { - this.exampleDAO = exampleDAO; - } - - public void setAnotherSampleDAO(IAnotherSampleDAO anotherSampleDAO) { - this.anotherSampleDAO = anotherSampleDAO; - } - - // standard setters and getters - - public IAnotherSampleDAO getAnotherSampleDAO() { - return anotherSampleDAO; - } - - public void setExampleDAO(ExampleDAOBean exampleDAO) { - this.exampleDAO = exampleDAO; - } - - public IExampleDAO getExampleDAO() { - return exampleDAO; - } - - private String propertyX; - - public String getPropertyX() { - return propertyX; - } - - public void setPropertyX(String propertyX) { - this.propertyX = propertyX; - } - - public List serviceMethodX() { - /*get domain list from DAO .. business logic on domain objects..return*/ - return exampleDAO.getDomainList(); - } - -} diff --git a/spring-core/src/main/java/com/baeldung/beaninjection/FileReader.java b/spring-core/src/main/java/com/baeldung/beaninjection/FileReader.java deleted file mode 100644 index 7ea64e2ce6..0000000000 --- a/spring-core/src/main/java/com/baeldung/beaninjection/FileReader.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung.beaninjection; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class FileReader { - - @Autowired - private Location location; - - public Location getLocation() { - return location; - } - - public void setLocation(Location location) { - this.location = location; - } -} diff --git a/spring-core/src/main/java/com/baeldung/beaninjection/FtpReader.java b/spring-core/src/main/java/com/baeldung/beaninjection/FtpReader.java deleted file mode 100644 index 259710ce94..0000000000 --- a/spring-core/src/main/java/com/baeldung/beaninjection/FtpReader.java +++ /dev/null @@ -1,28 +0,0 @@ -package com.baeldung.beaninjection; - -public class FtpReader { - private String ftpHost = null; - private Integer ftpPort = null; - - // Constructor with arguments - public FtpReader(String host, Integer port) { - this.ftpHost = host; - this.ftpPort = port; - } - - public String getFtpHost() { - return ftpHost; - } - - public void setFtpHost(String ftpHost) { - this.ftpHost = ftpHost; - } - - public Integer getFtpPort() { - return ftpPort; - } - - public void setFtpPort(Integer ftpPort) { - this.ftpPort = ftpPort; - } -} diff --git a/spring-core/src/main/java/com/baeldung/beaninjection/IAnotherSampleDAO.java b/spring-core/src/main/java/com/baeldung/beaninjection/IAnotherSampleDAO.java deleted file mode 100644 index ed4ad42705..0000000000 --- a/spring-core/src/main/java/com/baeldung/beaninjection/IAnotherSampleDAO.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.baeldung.beaninjection; - -public interface IAnotherSampleDAO { - -} diff --git a/spring-core/src/main/java/com/baeldung/beaninjection/IExampleDAO.java b/spring-core/src/main/java/com/baeldung/beaninjection/IExampleDAO.java deleted file mode 100644 index f7dbd2f9fe..0000000000 --- a/spring-core/src/main/java/com/baeldung/beaninjection/IExampleDAO.java +++ /dev/null @@ -1,12 +0,0 @@ -package com.baeldung.beaninjection; - -import java.util.List; - -public interface IExampleDAO { - - List getDomainList(); - - SampleDomainObject createNewDomain(SampleDomainObject domainObject); - - SampleDomainObject getSomeDomain(); -} diff --git a/spring-core/src/main/java/com/baeldung/beaninjection/IExampleService.java b/spring-core/src/main/java/com/baeldung/beaninjection/IExampleService.java deleted file mode 100644 index 9ea572d16b..0000000000 --- a/spring-core/src/main/java/com/baeldung/beaninjection/IExampleService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baeldung.beaninjection; - -import java.util.List; - -public interface IExampleService { - - List serviceMethodX(); - -} diff --git a/spring-core/src/main/java/com/baeldung/beaninjection/Location.java b/spring-core/src/main/java/com/baeldung/beaninjection/Location.java deleted file mode 100644 index 9ecab83ef6..0000000000 --- a/spring-core/src/main/java/com/baeldung/beaninjection/Location.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.beaninjection; - -import org.springframework.stereotype.Component; - -@Component -public class Location { - private String filePath; - - public String getFilePath() { - return filePath; - } - - public void setFilePath(String filePath) { - this.filePath = filePath; - } - -} diff --git a/spring-core/src/main/java/com/baeldung/beaninjection/ReaderApplicationConfig.java b/spring-core/src/main/java/com/baeldung/beaninjection/ReaderApplicationConfig.java deleted file mode 100644 index cf4d91b1f5..0000000000 --- a/spring-core/src/main/java/com/baeldung/beaninjection/ReaderApplicationConfig.java +++ /dev/null @@ -1,15 +0,0 @@ -package com.baeldung.beaninjection; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -@Configuration -@ComponentScan(basePackages = { "com.baeldung.beaninjection" }) -public class ReaderApplicationConfig { - - @Bean - public FtpReader exampleDAO() { - return new FtpReader("localhost", 21); - } -} diff --git a/spring-core/src/main/java/com/baeldung/beaninjection/ReaderManager.java b/spring-core/src/main/java/com/baeldung/beaninjection/ReaderManager.java deleted file mode 100644 index 155f2d6eea..0000000000 --- a/spring-core/src/main/java/com/baeldung/beaninjection/ReaderManager.java +++ /dev/null @@ -1,33 +0,0 @@ -package com.baeldung.beaninjection; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Component; - -@Component -public class ReaderManager { - private FileReader fileReader; - private FtpReader ftpReader; - - @Autowired - public ReaderManager(FtpReader ftpReader) { - this.ftpReader = ftpReader; - } - - @Autowired - public void setFileReader(FileReader fileReader) { - this.fileReader = fileReader; - } - - public FileReader getFileReader() { - return fileReader; - } - - public void setFtpReader(FtpReader ftpReader) { - this.ftpReader = ftpReader; - } - - public FtpReader getFtpReader() { - return ftpReader; - } - -} diff --git a/spring-core/src/main/java/com/baeldung/beaninjection/ReaderService.java b/spring-core/src/main/java/com/baeldung/beaninjection/ReaderService.java deleted file mode 100644 index 60bdac61e5..0000000000 --- a/spring-core/src/main/java/com/baeldung/beaninjection/ReaderService.java +++ /dev/null @@ -1,14 +0,0 @@ -package com.baeldung.beaninjection; - -public class ReaderService { - private FtpReader ftpReader; - - public void setFtpReader(FtpReader reader) { - this.ftpReader = reader; - } - - public FtpReader getFtpReader() { - return ftpReader; - } - -} diff --git a/spring-core/src/main/java/com/baeldung/beaninjection/SampleDomainObject.java b/spring-core/src/main/java/com/baeldung/beaninjection/SampleDomainObject.java deleted file mode 100644 index 3a5a913aa6..0000000000 --- a/spring-core/src/main/java/com/baeldung/beaninjection/SampleDomainObject.java +++ /dev/null @@ -1,31 +0,0 @@ -package com.baeldung.beaninjection; - -import java.io.Serializable; - -public class SampleDomainObject implements Serializable { - - /** - * - */ - private static final long serialVersionUID = 449859763481296747L; - - private String domainPropX; - private String domainPropY; - - public String getDomainPropX() { - return domainPropX; - } - - public void setDomainPropX(String domainPropX) { - this.domainPropX = domainPropX; - } - - public String getDomainPropY() { - return domainPropY; - } - - public void setDomainPropY(String domainPropY) { - this.domainPropY = domainPropY; - } - -} diff --git a/spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestBeanInjectionTypes.java b/spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestBeanInjectionTypes.java deleted file mode 100644 index 3939abf148..0000000000 --- a/spring-core/src/main/java/com/baeldung/configuration/ApplicationContextTestBeanInjectionTypes.java +++ /dev/null @@ -1,36 +0,0 @@ -package com.baeldung.configuration; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; - -import com.baeldung.beaninjection.AnotherSampleDAOBean; -import com.baeldung.beaninjection.ExampleDAOBean; -import com.baeldung.beaninjection.ExampleServiceBean; -import com.baeldung.beaninjection.IAnotherSampleDAO; -import com.baeldung.beaninjection.IExampleDAO; -import com.baeldung.beaninjection.IExampleService; - -@Configuration -@ComponentScan(basePackages = { "com.baeldung.beaninjection" }) -public class ApplicationContextTestBeanInjectionTypes { - - @Bean - public IExampleDAO exampleDAO() { - return new ExampleDAOBean("Mandatory DAO Property X"); - } - - @Bean - public IExampleService exampleServiceBean() { - ExampleServiceBean serviceBean = new ExampleServiceBean(exampleDAO()); - serviceBean.setAnotherSampleDAO(anotherSampleDAO()); - serviceBean.setPropertyX("Some Service Property X"); - return serviceBean; - } - - @Bean - public IAnotherSampleDAO anotherSampleDAO() { - return new AnotherSampleDAOBean("Mandatory DAO Property Y"); - } - -} diff --git a/spring-core/src/test/java/com/baeldung/beaninjection/FileReaderTest.java b/spring-core/src/test/java/com/baeldung/beaninjection/FileReaderTest.java deleted file mode 100644 index f843fddd4d..0000000000 --- a/spring-core/src/test/java/com/baeldung/beaninjection/FileReaderTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baeldung.beaninjection; - -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = ReaderApplicationConfig.class) -public class FileReaderTest { - - @Autowired - private ApplicationContext context; - - @Test - public void testAutowiredAnnotation_WhenField_ThenInjected() { - FileReader service = context.getBean(FileReader.class); - assertNotNull(service.getLocation()); - } -} diff --git a/spring-core/src/test/java/com/baeldung/beaninjection/FtpReaderTest.java b/spring-core/src/test/java/com/baeldung/beaninjection/FtpReaderTest.java deleted file mode 100644 index a11afff9ea..0000000000 --- a/spring-core/src/test/java/com/baeldung/beaninjection/FtpReaderTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.beaninjection; - -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = "classpath:injectiontypes.xml") -public class FtpReaderTest { - - @Autowired - private ApplicationContext context; - - @Test - public void testXMLBeanConfig_WhenConstructorArguments_ThenInjected() { - FtpReader service = context.getBean(FtpReader.class); - assertNotNull(service.getFtpHost()); - assertNotNull(service.getFtpPort()); - } -} diff --git a/spring-core/src/test/java/com/baeldung/beaninjection/ReaderManagerTest.java b/spring-core/src/test/java/com/baeldung/beaninjection/ReaderManagerTest.java deleted file mode 100644 index 7d85c0bf07..0000000000 --- a/spring-core/src/test/java/com/baeldung/beaninjection/ReaderManagerTest.java +++ /dev/null @@ -1,25 +0,0 @@ -package com.baeldung.beaninjection; - -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = ReaderApplicationConfig.class) -public class ReaderManagerTest { - - @Autowired - private ApplicationContext context; - - @Test - public void testAutowiredAnnotation_WhenConstructorAndSetter_ThenInjected() { - ReaderManager service = context.getBean(ReaderManager.class); - assertNotNull(service.getFtpReader()); - assertNotNull(service.getFileReader()); - } -} diff --git a/spring-core/src/test/java/com/baeldung/beaninjection/ReaderServiceTest.java b/spring-core/src/test/java/com/baeldung/beaninjection/ReaderServiceTest.java deleted file mode 100644 index da4684ad4e..0000000000 --- a/spring-core/src/test/java/com/baeldung/beaninjection/ReaderServiceTest.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.baeldung.beaninjection; - -import static org.junit.Assert.assertNotNull; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = "classpath:injectiontypes.xml") -public class ReaderServiceTest { - - @Autowired - private ApplicationContext context; - - @Test - public void testXMLBeanConfig_WhenSetter_ThenInjected() { - ReaderService service = context.getBean(ReaderService.class); - assertNotNull(service.getFtpReader()); - } -} diff --git a/spring-core/src/test/java/com/baeldung/test/beaninjection/BeanInjectionJavaConfigIntegrationTest.java b/spring-core/src/test/java/com/baeldung/test/beaninjection/BeanInjectionJavaConfigIntegrationTest.java deleted file mode 100644 index 809ce02519..0000000000 --- a/spring-core/src/test/java/com/baeldung/test/beaninjection/BeanInjectionJavaConfigIntegrationTest.java +++ /dev/null @@ -1,50 +0,0 @@ -package com.baeldung.test.beaninjection; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import com.baeldung.beaninjection.AnotherSampleDAOBean; -import com.baeldung.beaninjection.ExampleDAOBean; -import com.baeldung.beaninjection.ExampleServiceBean; -import com.baeldung.configuration.ApplicationContextTestBeanInjectionTypes; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(classes = ApplicationContextTestBeanInjectionTypes.class) -public class BeanInjectionJavaConfigIntegrationTest implements ApplicationContextAware { - - private ApplicationContext beanInjectedContext; - - @Test - public void testDAOInjectionByJava() { - ExampleServiceBean serviceBean = beanInjectedContext.getBean(ExampleServiceBean.class); - assertNotNull("Failed: Constructor Injection,Bean Reference Injection,Java Config, ExampleServiceBean", serviceBean.getExampleDAO()); - assertNotNull("Failed: Constructor Injection,Bean Reference Injection,Java Config, ExampleServiceBean", serviceBean.getAnotherSampleDAO()); - assertTrue("Failed: Constructor Injection,String Property , Java Config", serviceBean.getPropertyX() - .equals("Some Service Property X")); - } - - @Test - public void testPropertyInjectioninDAOByJava() { - ExampleDAOBean daoBean = beanInjectedContext.getBean(ExampleDAOBean.class); - assertTrue("Failed: Constructor Injection,String Property , Java Config", daoBean.getPropertyX() - .equals("Mandatory DAO Property X")); - - AnotherSampleDAOBean anotherDAOBean = beanInjectedContext.getBean(AnotherSampleDAOBean.class); - assertTrue("Failed: Constructor Injection,String Property , XML Config", anotherDAOBean.getPropertyY() - .equals("Mandatory DAO Property Y")); - } - - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - // TODO Auto-generated method stub - this.beanInjectedContext = applicationContext; - } -} diff --git a/spring-core/src/test/java/com/baeldung/test/beaninjection/BeanInjectionXMLConfigIntegrationTest.java b/spring-core/src/test/java/com/baeldung/test/beaninjection/BeanInjectionXMLConfigIntegrationTest.java deleted file mode 100644 index 2f29bb52a8..0000000000 --- a/spring-core/src/test/java/com/baeldung/test/beaninjection/BeanInjectionXMLConfigIntegrationTest.java +++ /dev/null @@ -1,49 +0,0 @@ -package com.baeldung.test.beaninjection; - -import static org.junit.Assert.assertNotNull; -import static org.junit.Assert.assertTrue; - -import org.junit.Test; -import org.junit.runner.RunWith; -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; - -import com.baeldung.beaninjection.AnotherSampleDAOBean; -import com.baeldung.beaninjection.ExampleDAOBean; -import com.baeldung.beaninjection.ExampleServiceBean; - -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration(locations = "classpath:beaninjectiontypes-context.xml") -public class BeanInjectionXMLConfigIntegrationTest implements ApplicationContextAware { - - private ApplicationContext beanInjectedContext; - - @Test - public void testDAOInjectionByXML() { - ExampleServiceBean serviceBean = beanInjectedContext.getBean(ExampleServiceBean.class); - assertNotNull("Failed: Constructor Injection,Bean Reference Injection,XML Config, ExampleServiceBean", serviceBean.getExampleDAO()); - assertNotNull("Failed: Constructor Injection,Bean Reference Injection,XML Config, ExampleServiceBean", serviceBean.getAnotherSampleDAO()); - assertTrue("Failed: Constructor Injection,String Property , XML Config", serviceBean.getPropertyX() - .equals("Some Service Property X")); - } - - @Test - public void testPropertyInjectioninDAOByXML() { - ExampleDAOBean daoBean = beanInjectedContext.getBean(ExampleDAOBean.class); - assertTrue("Failed: Constructor Injection,String Property , XML Config", daoBean.getPropertyX() - .equals("Mandatory DAO Property X")); - - AnotherSampleDAOBean anotherDAOBean = beanInjectedContext.getBean(AnotherSampleDAOBean.class); - assertTrue("Failed: Constructor Injection,String Property , XML Config", anotherDAOBean.getPropertyY() - .equals("Mandatory DAO Property Y")); - } - - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - // TODO Auto-generated method stub - this.beanInjectedContext = applicationContext; - } -}