snicoll edited a comment on issue #6: Rationalise use of ObjectMapper
URL: https://github.com/apache/rocketmq-spring/pull/6#issuecomment-447788366
 
 
   > your suggestion is to use the field injection instead of the method 
injection in the sample code? 
   
   I am not sure I got that. My suggestion is certainly not to use field 
injection. At all.
   
   >  we must ask user change the code if user has written this sort of method 
injection?
   
   As I've indicated in my previous comment, using field injection on the main 
context class is a bad practice regardless of this project. To be clear the 
cycle is [the field injection of the 
template](https://github.com/apache/rocketmq-spring/blob/c9fd3474d6354d2706f4baf205920c34261cbe01/rocketmq-spring-boot-samples/rocketmq-produce-demo/src/main/java/org/apache/rocketmq/samples/springboot/ProducerApplication.java#L47-L48).
 It will work just fine as long as you're not trying to customize things. By 
adding an `ObjectMapper` as a method as you've done here, it is very easy to 
create the cycle. 
   
   Your sample should not be written in your `@SpringBootApplication` 
regardless. The configuration should be separate as well to clearly show what 
is infrastructure and what is the sample itself. Doing this should be done 
regardless of this issue IMO.
   
   

----------------------------------------------------------------
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

Reply via email to