spring boot 应用程序未启动 - 错误(已停止 o.s.b.c.e.j.JettyEmbeddedWebAppContext)

springboot app not starting - error (Stopped o.s.b.c.e.j.JettyEmbeddedWebAppContext)

我在启动 restful spring 启动应用程序时遇到问题。在看到错误堆栈跟踪时,我可以看到一些与码头相关的异常。

我可以看到下面的日志。

Started o.s.b.c.e.j.JettyEmbeddedWebAppContext@26586b74{/,file:/C:/Windows/Temp/jetty-docbase.8144885224534920922.8080/,AVAILABLE}

我确实检查了 C:/windows/Temp,但找不到 jetty-docbase.8144885224534920922.8080

如果有人能帮我解决这个问题就太好了。我如何创建该文件以便码头识别它?

下面是完整的堆栈跟踪。

        mo.e.jetty.server.handler.ContextHandler; Started o.s.b.c.e.j.JettyEmbeddedWebAppContext@26586b74{/,file:/C:/Windows/Temp/jetty-docbase.8144885224534920922.8080/,AVAILABLE}
morg.eclipse.jetty.server.Server Started @7364ms
mationConfigEmbeddedWebApplicationContext Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.lewis.web.app.operations.dashboard.models.BuildInformation com.lewis.web.app.operations.dashboard.controllers.ConfigController.buildInformation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'buildInformationProperties': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String com.lewis.web.app.operations.dashboard.models.BuildInformationProperties.version; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'build.version' in string value "${build.version}"
mo.e.jetty.server.handler.ContextHandle Stopped o.s.b.c.e.j.JettyEmbeddedWebAppContext@26586b74{/,file:/C:/Windows/Temp/jetty-docbase.8144885224534920922.8080/,UNAVAILABLE}
mo.s.boot.SpringApplication  Application startup failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'configController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.lewis.web.app.operations.dashboard.models.BuildInformation com.lewis.web.app.operations.dashboard.controllers.ConfigController.buildInformation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'buildInformationProperties': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String com.lewis.web.app.operations.dashboard.models.BuildInformationProperties.version; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'build.version' in string value "${build.version}"
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:307)
    at com.lewis.web.app.Application.main(Application.java:25)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.lewis.web.app.operations.dashboard.models.BuildInformation com.lewis.web.app.operations.dashboard.controllers.ConfigController.buildInformation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'buildInformationProperties': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String com.lewis.web.app.operations.dashboard.models.BuildInformationProperties.version; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'build.version' in string value "${build.version}"
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
    ... 15 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'buildInformationProperties': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String com.lewis.web.app.operations.dashboard.models.BuildInformationProperties.version; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'build.version' in string value "${build.version}"
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)

    ... 17 common frames omitted
Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private java.lang.String com.lewis.web.app.operations.dashboard.models.BuildInformationProperties.version; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder 'build.version' in string value "${build.version}"
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:573)
    at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
    at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
    ... 37 common frames omitted
Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'build.version' in string value "${build.version}"
    at org.springframework.util.PropertyPlaceholderHelper.parseStringValue(PropertyPlaceholderHelper.java:174)

非常感谢...

您的实际异常是:

Caused by: java.lang.IllegalArgumentException: Could not resolve placeholder 'build.version' in string value "${build.version}"

这意味着,Spring 应用程序无法创建上下文并启动,因为无法创建某些 bean,因为它无法解析某些必需的自动装配变量,在您的情况下,它是 build.version.您可以尝试将此变量添加为命令行参数或将其作为 属性 添加到 application.properies 文件中。或者你可以找到这个 bean(它的名字是 buildInformationProperties,这个值应该是 autowird 并试着找出为什么你默认没有它。