I'm able to define bean with @Component
and add @Requestmapping
on that, But I have to define my bean with @Bean
because i have multiple beans of the same class. Each bean should have it's own URL.
I have tried to add @Requestmapping
on my method behind @Bean
but it wasn't allowed.
So how can i add @Requestmapping
on @Bean
?
Here is my Code:
@Bean("documentSearchServiceImpl")
public SearchServiceImpl documentSearchService(@Autowired @Qualifier("documentSearchEngine") SearchEngine searchEngine) {
return new SearchServiceImpl(searchEngine);
}