Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

第368页自定义starter问题 #53

Closed
itxingfeichen opened this issue Aug 10, 2019 · 1 comment
Closed

第368页自定义starter问题 #53

itxingfeichen opened this issue Aug 10, 2019 · 1 comment
Assignees
Labels
question Further information is requested

Comments

@itxingfeichen
Copy link

itxingfeichen commented Aug 10, 2019

走向自动装配章节,FormatterAutoConfiguration会出现比JacksonAutoConfiguration提前被初始化的情况,也就是说在FormatterAutoConfiguration初始化的时候,ObjectMapper还没有被初始化,会导致如下条件永远成立
@bean
@ConditionalOnClass(name = "com.fasterxml.jackson.databind.ObjectMapper")
@ConditionalOnMissingBean(type = "com.fasterxml.jackson.databind.ObjectMapper")
public Formatter jsonFormatter() {
return new JsonFormatter();
}
在个人测试过程中是这样,望小马哥解答。自动配置的顺序是如何控制的?

@itxingfeichen itxingfeichen changed the title 自定义starter 第368页自定义starter问题 Aug 10, 2019
@mercyblitz mercyblitz self-assigned this Dec 24, 2019
@mercyblitz mercyblitz added the question Further information is requested label Dec 24, 2019
@mercyblitz
Copy link
Owner

不同的操作系统可能存在加载 Class 的时机不同,如果你想绝对的控制的话,那么增加 @AutoConfigureBefore@AutoConfigureAfter

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants