I have the following code:
@Qualifier("dateObjectMapper")
private ObjectMapper mapper;
@Autowired
DefaultProjectTweetSearchProvider(
Client client,
ObjectMapper mapper) {
this.client = client;
this.mapper = mapper;
}
The above code is not working. I get an error message stating that the spring container cannot decide which bean to use in the constructor for ObjectMapper
. If I instead place @Resource(name = "dateObjectMapper")
above my mapper
field, it works. Why is it working in that case? I have 2 ObjectMapper
beans like so:
@Bean
ObjectMapper dateObjectMapper() {
// ...
}
@Bean
@Primary
ObjectMapper defaultObjectMapper() {
// ...
}