forked from PacktPublishing/Spring5-Design-Patterns
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
16f467f
commit be980cd
Showing
268 changed files
with
6,158 additions
and
3,046 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
15 changes: 15 additions & 0 deletions
15
.metadata/.plugins/org.eclipse.core.resources/.history/11/c06c2cb1e7600017121fc59bb9f2df75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:c="http://www.springframework.org/schema/c" | ||
xmlns:context="http://www.springframework.org/schema/context" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd | ||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd"> | ||
|
||
<context:annotation-config/> | ||
|
||
<bean id="transferService" class="com.packt.patterninspring.chapter5.bankapp.service.TransferService"> | ||
<constructor-arg ref="accountRepository"/> | ||
</bean> | ||
<bean id="accountRepository" class="com.packt.patterninspring.chapter5.bankapp.repository.JdbcAccountRepository"/> | ||
</beans> |
11 changes: 11 additions & 0 deletions
11
.metadata/.plugins/org.eclipse.core.resources/.history/12/70aedd14e1600017121fc59bb9f2df75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package com.packt.patterninspring.chapter5.bankapp.service; | ||
|
||
import com.packt.patterninspring.chapter4.bankapp.repository.IAccountRepository; | ||
|
||
/** | ||
* @author Dinesh Rajput | ||
* | ||
*/ | ||
public class TransferService { | ||
|
||
} |
10 changes: 7 additions & 3 deletions
10
...story/dc/90cbf2f80d58001715c2dd0dc1a02b70 → ...story/16/a08824d4e9600017121fc59bb9f2df75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,14 @@ | ||
package com.packt.patterninspring.chapter3.bankapp.config; | ||
package com.packt.patterninspring.chapter5.bankapp.config; | ||
|
||
import org.springframework.context.annotation.ComponentScan; | ||
import org.springframework.context.annotation.Configuration; | ||
|
||
/** | ||
* @author Dinesh.Rajput | ||
* | ||
*/ | ||
@Configuration | ||
@ComponentScan | ||
@ComponentScan("com.packt.patterninspring.chapter5.bankapp") | ||
public class AppConfig { | ||
|
||
} |
19 changes: 19 additions & 0 deletions
19
.metadata/.plugins/org.eclipse.core.resources/.history/1c/a080a519ea600017121fc59bb9f2df75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package com.packt.patterninspring.chapter5.bankapp.repository; | ||
|
||
import org.springframework.stereotype.Repository; | ||
|
||
import com.packt.patterninspring.chapter5.bankapp.model.Account; | ||
import com.packt.patterninspring.chapter5.bankapp.model.Amount; | ||
import com.packt.patterninspring.chapter5.bankapp.repository.AccountRepository; | ||
@Repository | ||
public class JdbcAccountRepository implements AccountRepository { | ||
|
||
@Override | ||
public Account findByAccountId(Long accountId) { | ||
return new Account(accountId, "Arnav Rajput", new Amount(3000.0)); | ||
} | ||
|
||
void populateCache(){ | ||
System.out.println("Called populateCache() method"); | ||
} | ||
} |
11 changes: 11 additions & 0 deletions
11
.metadata/.plugins/org.eclipse.core.resources/.history/1f/a0507ec5e0600017121fc59bb9f2df75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
eclipse.preferences.version=1 | ||
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled | ||
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8 | ||
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve | ||
org.eclipse.jdt.core.compiler.compliance=1.8 | ||
org.eclipse.jdt.core.compiler.debug.lineNumber=generate | ||
org.eclipse.jdt.core.compiler.debug.localVariable=generate | ||
org.eclipse.jdt.core.compiler.debug.sourceFile=generate | ||
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error | ||
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error | ||
org.eclipse.jdt.core.compiler.source=1.8 |
30 changes: 30 additions & 0 deletions
30
.metadata/.plugins/org.eclipse.core.resources/.history/1f/a0514bde2463001713a1b9fc995d18b8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/** | ||
* | ||
*/ | ||
package com.doj.app.test; | ||
|
||
import org.springframework.context.ConfigurableApplicationContext; | ||
import org.springframework.context.support.ClassPathXmlApplicationContext; | ||
|
||
import com.doj.app.bean.MyBean; | ||
|
||
/** | ||
* @author Dinesh.Rajput | ||
* | ||
*/ | ||
public class Main { | ||
/** | ||
* @param args | ||
*/ | ||
public static void main(String[] args) { | ||
ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml"); | ||
MyBean myBean = applicationContext.getBean(MyBean.class); | ||
System.out.println(myBean.getName()); | ||
System.out.println("All registered Scopes are : "); | ||
for(String scope : applicationContext.getBeanFactory().getRegisteredScopeNames()){ | ||
System.out.println(scope); | ||
} | ||
applicationContext.close(); | ||
} | ||
|
||
} |
9 changes: 9 additions & 0 deletions
9
.metadata/.plugins/org.eclipse.core.resources/.history/21/90506655e7600017121fc59bb9f2df75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
package com.packt.patterninspring.chapter5.bankapp.repository; | ||
|
||
import com.packt.patterninspring.chapter3.bankapp.model.Account; | ||
import com.packt.patterninspring.chapter3.bankapp.model.Amount; | ||
|
||
public interface TransferRepository { | ||
|
||
void transfer(Account accountA, Account accountB, Amount amount); | ||
} |
22 changes: 22 additions & 0 deletions
22
.metadata/.plugins/org.eclipse.core.resources/.history/27/5086bbfc2463001713a1b9fc995d18b8
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
/** | ||
* | ||
*/ | ||
package com.packt.patterninspring.chapter5.bankapp.bean; | ||
|
||
/** | ||
* @author Dinesh.Rajput | ||
* | ||
*/ | ||
|
||
public class MyBean { | ||
String name; | ||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public void setName(String name) { | ||
this.name = name; | ||
} | ||
|
||
} |
30 changes: 0 additions & 30 deletions
30
.metadata/.plugins/org.eclipse.core.resources/.history/29/b06188f30d58001715c2dd0dc1a02b70
This file was deleted.
Oops, something went wrong.
16 changes: 16 additions & 0 deletions
16
.metadata/.plugins/org.eclipse.core.resources/.history/29/d0c54c50e7600017121fc59bb9f2df75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.packt.patterninspring.chapter3.bankapp.repository; | ||
|
||
import org.springframework.stereotype.Repository; | ||
|
||
import com.packt.patterninspring.chapter3.bankapp.model.Account; | ||
import com.packt.patterninspring.chapter3.bankapp.model.Amount; | ||
import com.packt.patterninspring.chapter3.bankapp.repository.AccountRepository; | ||
@Repository | ||
public class JdbcAccountRepository implements AccountRepository { | ||
|
||
@Override | ||
public Account findByAccountId(Long accountId) { | ||
return new Account(accountId, "Arnav Rajput", new Amount(3000.0)); | ||
} | ||
|
||
} |
21 changes: 3 additions & 18 deletions
21
...story/bd/808d09d9865e00171fe08ac325c83bc9 → ...story/2b/80995f01e1600017121fc59bb9f2df75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1,17 @@ | ||
/** | ||
* | ||
*/ | ||
package com.doj.app.service; | ||
|
||
import org.springframework.stereotype.Service; | ||
package com.packt.patterninspring.chapter4.bankapp.service; | ||
|
||
import com.doj.app.repository.IAccountRepository; | ||
import com.packt.patterninspring.chapter4.bankapp.repository.IAccountRepository; | ||
|
||
/** | ||
* @author Manzoor Alam | ||
* @author Dinesh Rajput | ||
* | ||
*/ | ||
@Service("service") | ||
public class TransferService { | ||
|
||
IAccountRepository accountRepository; | ||
|
||
public TransferService(IAccountRepository accountRepository){ | ||
this.accountRepository = accountRepository; | ||
} | ||
|
||
public void transfer(String accountA, String accountB, Double amount){ | ||
System.out.println("Amount has been tranferred"); | ||
} | ||
|
||
public void setAccountRepository(IAccountRepository accountRepository) { | ||
this.accountRepository = accountRepository; | ||
} | ||
|
||
|
||
} |
20 changes: 20 additions & 0 deletions
20
.metadata/.plugins/org.eclipse.core.resources/.history/2c/90b1c5c2e6600017121fc59bb9f2df75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
package com.packt.patterninspring.chapter5.bankapp; | ||
|
||
import org.springframework.context.ConfigurableApplicationContext; | ||
import org.springframework.context.annotation.AnnotationConfigApplicationContext; | ||
|
||
import com.packt.patterninspring.chapter5.bankapp.config.AppConfig; | ||
|
||
/** | ||
* @author Dinesh Rajput | ||
* | ||
*/ | ||
public class BeanLifeCycleDemo { | ||
|
||
public static void main(String[] args) { | ||
//ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml"); | ||
ConfigurableApplicationContext applicationContext = new AnnotationConfigApplicationContext(AppConfig.class); | ||
applicationContext.close(); | ||
} | ||
|
||
} |
23 changes: 23 additions & 0 deletions
23
.metadata/.plugins/org.eclipse.core.resources/.history/2e/c01d18dee1600017121fc59bb9f2df75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package com.packt.patterninspring.chapter5.bankapp.bpp; | ||
|
||
import org.springframework.beans.BeansException; | ||
import org.springframework.beans.factory.config.BeanPostProcessor; | ||
|
||
/** | ||
* @author Dinesh.Rajput | ||
* | ||
*/ | ||
public class MyBeanPostProcessor implements BeanPostProcessor { | ||
|
||
@Override | ||
public Object postProcessBeforeInitialization(Object bean, String beanName) throws BeansException { | ||
System.out.println("In After bean Initialization method. Bean name is "+beanName); | ||
return bean; | ||
} | ||
|
||
public Object postProcessAfterInitialization(Object bean, String beanName) throws BeansException { | ||
System.out.println("In Before bean Initialization method. Bean name is "+beanName); | ||
return bean; | ||
} | ||
|
||
} |
10 changes: 0 additions & 10 deletions
10
.metadata/.plugins/org.eclipse.core.resources/.history/2f/00e5d1196c57001715879b610a39a80b
This file was deleted.
Oops, something went wrong.
17 changes: 0 additions & 17 deletions
17
.metadata/.plugins/org.eclipse.core.resources/.history/31/908c99cd7257001715879b610a39a80b
This file was deleted.
Oops, something went wrong.
21 changes: 21 additions & 0 deletions
21
.metadata/.plugins/org.eclipse.core.resources/.history/35/6024daf2e1600017121fc59bb9f2df75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
package com.packt.patterninspring.chapter4.bankapp; | ||
|
||
import org.springframework.context.ConfigurableApplicationContext; | ||
import org.springframework.context.support.ClassPathXmlApplicationContext; | ||
|
||
import com.packt.patterninspring.chapter5.bankapp.service.TransferService; | ||
|
||
/** | ||
* @author Dinesh Rajput | ||
* | ||
*/ | ||
public class FactoryBeanDemo { | ||
|
||
public static void main(String[] args) { | ||
ConfigurableApplicationContext applicationContext = new ClassPathXmlApplicationContext("applicationContext.xml"); | ||
TransferService transferService = applicationContext.getBean(TransferService.class); | ||
transferService.transfer("A", "B", 3000.1); | ||
applicationContext.close(); | ||
} | ||
|
||
} |
14 changes: 14 additions & 0 deletions
14
.metadata/.plugins/org.eclipse.core.resources/.history/39/808916b3e7600017121fc59bb9f2df75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<beans xmlns="http://www.springframework.org/schema/beans" | ||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" | ||
xmlns:c="http://www.springframework.org/schema/c" | ||
xmlns:context="http://www.springframework.org/schema/context" | ||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd | ||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-4.3.xsd"> | ||
|
||
<context:annotation-config/> | ||
|
||
<bean id="transferService" class="com.packt.patterninspring.chapter5.bankapp.service.TransferService"/> | ||
</bean> | ||
<bean id="accountRepository" class="com.packt.patterninspring.chapter5.bankapp.repository.JdbcAccountRepository"/> | ||
</beans> |
File renamed without changes.
1 change: 1 addition & 0 deletions
1
.metadata/.plugins/org.eclipse.core.resources/.history/3e/1001a4c5e0600017121fc59bb9f2df75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/bin/ |
27 changes: 27 additions & 0 deletions
27
.metadata/.plugins/org.eclipse.core.resources/.history/4/507883cfe0600017121fc59bb9f2df75
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
<modelVersion>4.0.0</modelVersion> | ||
<groupId>Chapter-05-Spring-Life-Cycle-Callback</groupId> | ||
<artifactId>Chapter-05-Spring-Life-Cycle-Callback</artifactId> | ||
<version>0.0.1-SNAPSHOT</version> | ||
<build> | ||
<sourceDirectory>src</sourceDirectory> | ||
<resources> | ||
<resource> | ||
<directory>config</directory> | ||
<excludes> | ||
<exclude>**/*.java</exclude> | ||
</excludes> | ||
</resource> | ||
</resources> | ||
<plugins> | ||
<plugin> | ||
<artifactId>maven-compiler-plugin</artifactId> | ||
<version>3.5.1</version> | ||
<configuration> | ||
<source>1.8</source> | ||
<target>1.8</target> | ||
</configuration> | ||
</plugin> | ||
</plugins> | ||
</build> | ||
</project> |
17 changes: 0 additions & 17 deletions
17
.metadata/.plugins/org.eclipse.core.resources/.history/42/f0092ea77257001715879b610a39a80b
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.