我使用spring 5.3.7
当我启动我的应用程序时,它返回下面的错误:
Instantiation of bean failed; nested exception is
org.springframework.beans.BeanInstantiationException: Failed to instantiate
[org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter]:
Constructor threw exception; nested exception is java.lang.NoSuchFieldError:
com/fasterxml/jackson/annotation/JsonInclude$Include.USE_DEFAULTS
我使用jackson-annotations-2.10.3.jar
实现USE_DEFAULTS Enum。我希望有人能帮助我。
尝试清理旧版本并重新构建项目,至少它对我有效!
我不确定,但是你应该检查一下像@Service, @Controller, @Respository这样的注释,有可能你错过了任何一个注释。请仔细检查一下,它可能会对你有所帮助。
要处理这个错误,我们必须清除所有。class文件并重新编译以确保所有文件都是最新的。
如果此错误在运行时仍然存在,则可能是编译时引用的依赖项与运行时版本不同。在这里,有必要检查各种路径和版本是否错误。
Maven项目一般执行mvn clean.
希望你的问题能得到解决