snicoll commented on a change in pull request #4: 修复当ObjectMapper 的 Bean
已存在时候,不叫rocketMQMessageObjectMapper,无法启动
URL: https://github.com/apache/rocketmq-spring/pull/4#discussion_r241681567
##########
File path:
rocketmq-spring-boot/src/main/java/org/apache/rocketmq/spring/config/RocketMQAutoConfiguration.java
##########
@@ -66,7 +66,7 @@ public DefaultMQProducer
defaultMQProducer(RocketMQProperties rocketMQProperties
@Bean
@ConditionalOnClass(name = "com.fasterxml.jackson.databind.ObjectMapper")
- @ConditionalOnMissingBean(ObjectMapper.class)
+ @ConditionalOnMissingBean(name = "rocketMQMessageObjectMapper")
Review comment:
That's what I am trying to get at. You should order this auto-configuration
to run _after_ `JacksonAutoConfiguration`. That way, you have the guarantee
that an `ObjectMapper` will be provided by Spring Boot.
If you like to create a different one internally with different settings,
you can also do so using `Jackson2ObjectMapperBuilder` that is provided by
Spring Boot (same auto-configuration).
If a user has switched off `JacksonAutoConfiguration` and this part of your
starter does not work, that's totally fine IMO: users that apply such
customizations to the auto-configurations are responsible to manage such cases
manually.
In general, I don't encourage you to use qualifiers like that. I am happy to
submit a PR that expresses in code what I've just explained. Let me know if you
want me to do that.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services