FormatterAutoConfiguration要输出objectMapperFormatter是有隐含条件的
leogan12 opened this issue · 1 comments
leogan12 commented
358-370页 9.4.2 bean的条件注解 一章用到的例子FormatterAutoConfiguration要输出objectMapperFormatter的前提条件是 JacksonAutoConfiguration.JacksonObjectMapperConfiguration#jacksonObjectMapper matched ,这里的隐含条件是JacksonAutoConfiguration要先于FormatterAutoConfiguration配置好,您的例子刚好,正确输出了[Bean name : objectMapperFormatter] JsonFormatter.format(data) : {"name":"小马哥"},而我的例子始终只能输出jsonFormatter,不知何故?
后来我在您的例子上加上
@AutoConfigureBefore(JacksonAutoConfiguration.class)
public class FormatterAutoConfiguration
后,也只能输出jsonFormatter
而在我的例子上加上
@AutoConfigureAfter(JacksonAutoConfiguration.class)
public class FormatterAutoConfiguration
后,也能正确输出objectMapperFormatter
建议您再版时,加上这个隐含条件