Created
December 5, 2013 10:05
-
-
Save Qkyrie/7802948 to your computer and use it in GitHub Desktop.
A Custom Qualifier for Spring
This file contains hidden or 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
<bean class="example.SimpleMovieCatalog"> | |
<qualifier type="example.Genre" value="Comedy"/> | |
<!-- inject any dependencies required by this bean --> | |
</bean> |
This file contains hidden or 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
@Target({ElementType.FIELD, ElementType.PARAMETER}) | |
@Retention(RetentionPolicy.RUNTIME) | |
@Qualifier | |
public @interface Offline { | |
} |
This file contains hidden or 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
@Target({ElementType.FIELD, ElementType.PARAMETER}) | |
@Retention(RetentionPolicy.RUNTIME) | |
@Qualifier | |
public @interface Genre { | |
String value(); | |
} |
This file contains hidden or 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
<bean class="example.SimpleMovieCatalog"> | |
<qualifier type="Offline"/> | |
<!-- inject any dependencies required by this bean --> | |
</bean> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment