Behrang Saeedzadeh opened SPR-14677 and commented
It would be nice if we could declare that a given bean has a particular stereotype using Java based configuration. For example:
@Bean
@Service
public TwitterService twitterService() {
// ...
}
@Bean
@Repository
public TweetRepository tweetRepository() {
// ...
}
or
@Service
public TwitterService twitterService() {
// ...
}
or
@Bean(stereotype = Service.class)
public TwitterService twitterService() {
// ...
}
No further details from SPR-14677
Comment From: spring-projects-issues
Bulk closing outdated, unresolved issues. Please, reopen if still relevant.
Comment From: behrangsa
Please reopen this issue.
Comment From: rstoyanchev
Team Decision: We've discussed this, and don't see it as a good fit on, because it would make it possible to declare multiple beans of the same type, with different stereotypes. A stereotype annotation really belonging on the class declaration where it's clear the a single class can only be one kind of component.
If this is for autowiring purposes, you could add @Qualifier
. If not, please provide more details on how you use the stereotype metadata, so we can provide some further guidance.
Comment From: spring-projects-issues
If you would like us to look at this issue, please provide the requested information. If the information is not provided within the next 7 days this issue will be closed.
Comment From: spring-projects-issues
Closing due to lack of requested feedback. If you would like us to look at this issue, please provide the requested information and we will re-open the issue.