From 91dedcc9cb07ac0c74de50c44c557744c10b449e Mon Sep 17 00:00:00 2001 From: Raksha Rao Date: Mon, 5 Feb 2018 16:36:21 +0530 Subject: [PATCH] remove unnecessary sample files --- .../AccountDetails.java | 40 ----------------- .../BankAccountApplication.java | 19 -------- .../BankAccountService.java | 9 ---- .../BankAccountWithConstructorInjection.java | 17 ------- .../BankAccountWithSetterInjection.java | 22 --------- .../SampleBeanInjectionTest.java | 45 ------------------- 6 files changed, 152 deletions(-) delete mode 100644 spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/AccountDetails.java delete mode 100644 spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/BankAccountApplication.java delete mode 100644 spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/BankAccountService.java delete mode 100644 spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/BankAccountWithConstructorInjection.java delete mode 100644 spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/BankAccountWithSetterInjection.java delete mode 100644 spring-core/src/test/java/com/baeldung/samplebeaninjectiontypes/SampleBeanInjectionTest.java diff --git a/spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/AccountDetails.java b/spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/AccountDetails.java deleted file mode 100644 index 2e4eb3b894..0000000000 --- a/spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/AccountDetails.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.baeldung.samplebeaninjectionypes; - -public class AccountDetails { - - private Long accountNumber; - - private String accountType; - - private String accountName; - - public AccountDetails(Long accountNumber, String accountType, String accountName) { - this.accountNumber = accountNumber; - this.accountType = accountType; - this.accountName = accountName; - } - - public Long getAccountNumber() { - return accountNumber; - } - - public void setAccountNumber(Long accountNumber) { - this.accountNumber = accountNumber; - } - - public String getAccountType() { - return accountType; - } - - public void setAccountType(String accountType) { - this.accountType = accountType; - } - - public String getAccountName() { - return accountName; - } - - public void setAccountName(String accountName) { - this.accountName = accountName; - } -} diff --git a/spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/BankAccountApplication.java b/spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/BankAccountApplication.java deleted file mode 100644 index 466255fd2e..0000000000 --- a/spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/BankAccountApplication.java +++ /dev/null @@ -1,19 +0,0 @@ -package com.baeldung.samplebeaninjectionypes; - -import org.springframework.context.ApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -public class BankAccountApplication { - - - public static void main(String[] args) { - ApplicationContext context = new ClassPathXmlApplicationContext("samplebeaninjectiontypes-context.xml"); - BankAccountWithSetterInjection bankAccountWithSetterInjection = (BankAccountWithSetterInjection) context.getBean("bankAccountWithSetterInjectionBean"); - - bankAccountWithSetterInjection.openAccount(12345L,"Savings","John Doe"); - - BankAccountWithConstructorInjection bankAccountWithConstructorInjection = (BankAccountWithConstructorInjection) context.getBean("bankAccountWithConstructorInjectionBean"); - bankAccountWithSetterInjection.openAccount(12345L,"Savings","John Doe"); - - } -} diff --git a/spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/BankAccountService.java b/spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/BankAccountService.java deleted file mode 100644 index 0f62db3655..0000000000 --- a/spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/BankAccountService.java +++ /dev/null @@ -1,9 +0,0 @@ -package com.baeldung.samplebeaninjectionypes; - -public class BankAccountService { - - public AccountDetails openAccount(Long accountNumber, String accountType, String owner) { - AccountDetails accountDetails = new AccountDetails(accountNumber,accountType,owner); - return accountDetails; - } -} diff --git a/spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/BankAccountWithConstructorInjection.java b/spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/BankAccountWithConstructorInjection.java deleted file mode 100644 index 1bc75d15e0..0000000000 --- a/spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/BankAccountWithConstructorInjection.java +++ /dev/null @@ -1,17 +0,0 @@ -package com.baeldung.samplebeaninjectionypes; - -import org.springframework.beans.factory.annotation.Autowired; - -public class BankAccountWithConstructorInjection { - private BankAccountService bankAccountService; - - @Autowired - public BankAccountWithConstructorInjection(BankAccountService service) { - this.bankAccountService = service; - } - - public AccountDetails openAccount(Long accountNumber, String accountType, String owner) { - return bankAccountService.openAccount(accountNumber, accountType, owner); - } - -} diff --git a/spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/BankAccountWithSetterInjection.java b/spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/BankAccountWithSetterInjection.java deleted file mode 100644 index 69c1fec4cc..0000000000 --- a/spring-core/src/main/java/com/baeldung/samplebeaninjectionypes/BankAccountWithSetterInjection.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.baeldung.samplebeaninjectionypes; - -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.beans.factory.annotation.Qualifier; - -public class BankAccountWithSetterInjection { - - private BankAccountService bankAccountService; - - public BankAccountWithSetterInjection(BankAccountService service) { - this.bankAccountService = service; - } - - @Autowired - public void setBankAccountService(BankAccountService bankAccountService) { - this.bankAccountService = bankAccountService; - } - - public AccountDetails openAccount(Long accountNumber, String accountType, String owner) { - return bankAccountService.openAccount(accountNumber, accountType, owner); - } -} diff --git a/spring-core/src/test/java/com/baeldung/samplebeaninjectiontypes/SampleBeanInjectionTest.java b/spring-core/src/test/java/com/baeldung/samplebeaninjectiontypes/SampleBeanInjectionTest.java deleted file mode 100644 index fb7234e5c5..0000000000 --- a/spring-core/src/test/java/com/baeldung/samplebeaninjectiontypes/SampleBeanInjectionTest.java +++ /dev/null @@ -1,45 +0,0 @@ -package com.baeldung.samplebeaninjectiontypes; - -import com.baeldung.dependencyinjectiontypes.ArticleWithSetterInjection; -import com.baeldung.samplebeaninjectionypes.AccountDetails; -import com.baeldung.samplebeaninjectionypes.BankAccountWithConstructorInjection; -import com.baeldung.samplebeaninjectionypes.BankAccountWithSetterInjection; -import org.junit.Before; -import org.junit.Test; -import org.springframework.context.ApplicationContext; -import org.springframework.context.annotation.AnnotationConfigApplicationContext; -import org.springframework.context.support.ClassPathXmlApplicationContext; - -import static org.junit.Assert.assertTrue; - -public class SampleBeanInjectionTest { - ApplicationContext context; - - @Before - public void before(){ - context = new ClassPathXmlApplicationContext("dependencyinjectiontypes-context.xml"); - } - - @Test - public void givenAutowiredAnnotation_WhenSetOnSetter_ThenDependencyValid() { - - BankAccountWithSetterInjection bankAccountWithSetterInjection = (BankAccountWithSetterInjection) context.getBean("bankAccountWithSetterInjection"); - - String owner = "John Doe"; - AccountDetails accountDetails = bankAccountWithSetterInjection.openAccount(12345L,"Savings",owner); - - assertTrue(accountDetails.getAccountName().equals(owner)); - - } - - @Test - public void givenAutowiredAnnotation_WhenSetOnConstructor_ThenDependencyValid() { - - BankAccountWithConstructorInjection bankAccountWithConstructorInjection = (BankAccountWithConstructorInjection) context.getBean("bankAccountWithConstructorInjectionBean"); - - String owner = "John Doe"; - AccountDetails accountDetails = bankAccountWithConstructorInjection.openAccount(12345L,"Savings",owner); - - assertTrue(accountDetails.getAccountName().equals(owner)); - } -}