Created
March 9, 2016 22:00
-
-
Save maciejwalkowiak/c7a66aaca8106a8db951 to your computer and use it in GitHub Desktop.
Class dependencies
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
class SomeService { | |
private final DependencyA dependencyA; | |
private final DependencyB dependencyB; | |
private final Optional<DependencyC> dependencyC; | |
@Autowired | |
public SomeService(DependencyA dependencyA, | |
DependencyB dependencyB, | |
Optional<DependencyC> dependencyC) { | |
Assert.notNull(dependencyA); | |
Assert.notNull(dependencyB); | |
Assert.notNull(dependencyC); | |
this.dependencyA = dependencyA; | |
this.dependencyB = dependencyB; | |
this.dependencyC = dependencyC; | |
} | |
public SomeService(DependencyA dependencyA, DependencyB dependencyB§) { | |
this(dependencyA, dependencyB, Optional.empty()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment