forked from eugenp/tutorials
-
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.
BAEL-2399: Migrate Spring DI example to spring-core module
- Loading branch information
1 parent
874acdd
commit 01fa4cf
Showing
26 changed files
with
129 additions
and
78 deletions.
There are no files selected for viewing
File renamed without changes.
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,45 +1,29 @@ | ||
<?xml version="1.0" encoding="UTF-8"?> | ||
<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>com.baeldung.examples.guice</groupId> | ||
<artifactId>guice</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<name>guice</name> | ||
<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>com.baeldung.examples.guice</groupId> | ||
<artifactId>guice</artifactId> | ||
<version>1.0-SNAPSHOT</version> | ||
<packaging>jar</packaging> | ||
<name>guice</name> | ||
|
||
<parent> | ||
<groupId>com.baeldung</groupId> | ||
<artifactId>parent-modules</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
<parent> | ||
<groupId>com.baeldung</groupId> | ||
<artifactId>parent-modules</artifactId> | ||
<version>1.0.0-SNAPSHOT</version> | ||
</parent> | ||
|
||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.inject</groupId> | ||
<artifactId>guice</artifactId> | ||
<version>${guice.version}</version> | ||
</dependency> | ||
<dependencies> | ||
<dependency> | ||
<groupId>com.google.inject</groupId> | ||
<artifactId>guice</artifactId> | ||
<version>${guice.version}</version> | ||
</dependency> | ||
</dependencies> | ||
|
||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-context</artifactId> | ||
<version>${spring.version}</version> | ||
</dependency> | ||
<properties> | ||
<guice.version>4.1.0</guice.version> | ||
</properties> | ||
|
||
<dependency> | ||
<groupId>org.springframework</groupId> | ||
<artifactId>spring-test</artifactId> | ||
<version>${springtest.version}</version> | ||
<scope>test</scope> | ||
</dependency> | ||
</dependencies> | ||
|
||
<properties> | ||
<guice.version>4.2.2</guice.version> | ||
<spring.version>5.1.3.RELEASE</spring.version> | ||
<springtest.version>5.1.3.RELEASE</springtest.version> | ||
</properties> | ||
|
||
</project> | ||
</project> |
3 changes: 0 additions & 3 deletions
3
guice/src/main/java/com/baeldung/examples/common/Account.java
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
3 changes: 0 additions & 3 deletions
3
guice/src/main/java/com/baeldung/examples/common/AccountServiceImpl.java
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,8 +1,5 @@ | ||
package com.baeldung.examples.common; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class AccountServiceImpl implements AccountService { | ||
|
||
} |
3 changes: 0 additions & 3 deletions
3
guice/src/main/java/com/baeldung/examples/common/BookServiceImpl.java
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,7 @@ | ||
package com.baeldung.examples.common; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
public class BookServiceImpl implements BookService { | ||
|
||
@Autowired(required = false) | ||
private AuthorService authorService; | ||
|
||
} |
3 changes: 0 additions & 3 deletions
3
guice/src/main/java/com/baeldung/examples/common/PersonDaoImpl.java
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,8 +1,5 @@ | ||
package com.baeldung.examples.common; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class PersonDaoImpl implements PersonDao { | ||
|
||
} |
3 changes: 0 additions & 3 deletions
3
guice/src/main/java/com/baeldung/examples/guice/FooProcessor.java
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,12 +1,9 @@ | ||
package com.baeldung.examples.guice; | ||
|
||
import org.springframework.lang.Nullable; | ||
|
||
import com.google.inject.Inject; | ||
|
||
public class FooProcessor { | ||
|
||
@Inject | ||
@Nullable | ||
private Foo foo; | ||
} |
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
27 changes: 27 additions & 0 deletions
27
spring-core/src/main/java/com/baeldung/di/spring/Account.java
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 @@ | ||
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; | ||
} | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
spring-core/src/main/java/com/baeldung/di/spring/AccountService.java
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,5 @@ | ||
package com.baeldung.di.spring; | ||
|
||
public interface AccountService { | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
spring-core/src/main/java/com/baeldung/di/spring/AccountServiceImpl.java
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,8 @@ | ||
package com.baeldung.di.spring; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class AccountServiceImpl implements AccountService { | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
spring-core/src/main/java/com/baeldung/di/spring/AudioBookService.java
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,5 @@ | ||
package com.baeldung.di.spring; | ||
|
||
public interface AudioBookService { | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
spring-core/src/main/java/com/baeldung/di/spring/AudioBookServiceImpl.java
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,5 @@ | ||
package com.baeldung.di.spring; | ||
|
||
public class AudioBookServiceImpl implements AudioBookService { | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
spring-core/src/main/java/com/baeldung/di/spring/AuthorService.java
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,5 @@ | ||
package com.baeldung.di.spring; | ||
|
||
public interface AuthorService { | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
spring-core/src/main/java/com/baeldung/di/spring/AuthorServiceImpl.java
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,5 @@ | ||
package com.baeldung.di.spring; | ||
|
||
public class AuthorServiceImpl implements AuthorService { | ||
|
||
} |
5 changes: 5 additions & 0 deletions
5
spring-core/src/main/java/com/baeldung/di/spring/BookService.java
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,5 @@ | ||
package com.baeldung.di.spring; | ||
|
||
public interface BookService { | ||
|
||
} |
10 changes: 10 additions & 0 deletions
10
spring-core/src/main/java/com/baeldung/di/spring/BookServiceImpl.java
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,10 @@ | ||
package com.baeldung.di.spring; | ||
|
||
import org.springframework.beans.factory.annotation.Autowired; | ||
|
||
public class BookServiceImpl implements BookService { | ||
|
||
@Autowired(required = false) | ||
private AuthorService authorService; | ||
|
||
} |
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,4 @@ | ||
package com.baeldung.di.spring; | ||
|
||
public class Foo { | ||
} |
6 changes: 6 additions & 0 deletions
6
spring-core/src/main/java/com/baeldung/di/spring/FooProcessor.java
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,6 @@ | ||
package com.baeldung.di.spring; | ||
|
||
public class FooProcessor { | ||
|
||
private Foo foo; | ||
} |
5 changes: 5 additions & 0 deletions
5
spring-core/src/main/java/com/baeldung/di/spring/PersonDao.java
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,5 @@ | ||
package com.baeldung.di.spring; | ||
|
||
public interface PersonDao { | ||
|
||
} |
8 changes: 8 additions & 0 deletions
8
spring-core/src/main/java/com/baeldung/di/spring/PersonDaoImpl.java
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,8 @@ | ||
package com.baeldung.di.spring; | ||
|
||
import org.springframework.stereotype.Component; | ||
|
||
@Component | ||
public class PersonDaoImpl implements PersonDao { | ||
|
||
} |
5 changes: 1 addition & 4 deletions
5
...ng/examples/spring/SpringBeansConfig.java → ...baeldung/di/spring/SpringBeansConfig.java
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
7 changes: 2 additions & 5 deletions
7
...ung/examples/spring/SpringMainConfig.java → .../baeldung/di/spring/SpringMainConfig.java
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
4 changes: 1 addition & 3 deletions
4
.../examples/spring/SpringPersonService.java → ...eldung/di/spring/SpringPersonService.java
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
4 changes: 1 addition & 3 deletions
4
...baeldung/examples/spring/UserService.java → ...a/com/baeldung/di/spring/UserService.java
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
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