我正在对我的一个项目工件进行一些转换,以便我们可以使用 spring boot 运行它,而不是仅部署到 jboss,以及添加执行器。这非常顺利,但是在使一切都在 spring boot 上运行的过程中,我破坏了将 WAR 部署到 jboss 的能力。
具体来说,我已将 BuildInformation 添加到我们的部署信息端点。根据我对执行器和 build-info.properties 创建的理解,以及我在试图找到其他有此问题的人时发现的每一个谷歌结果,我目前正在做的应该是在职的。我有
compile 'org.springframework.boot:spring-boot-starter-actuator'
在我的平台级项目的 gradle 的 subprojects
部分(以及我们使用的所有其他 spring-boot 依赖项)。 springBoot
任务配置为运行 buildInfo()
。生成的 WAR 文件在 /WEB-INF/classes/META-INF/
下具有 build-info.properties
文件。一切似乎都按照预期的方式组合在一起。然而:
13:09:59,517 ERROR [org.springframework.web.servlet.DispatcherServlet] (ServerService Thread Pool -- 53) Context initialization failed: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'pingController' defined in VFS resource ["<snip>/PingController.class"]: Unsatisfied dependency expressed through constructor parameter 0; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.boot.info.BuildProperties' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {}
关于我应该看哪里的任何想法?
最佳答案
尽管带有 main
方法的类被 @SpringBootApplication
注释,但在打包到 WAR 中时仍未启用自动配置。我在我的根 @Configuration
类上添加了 @EnableAutoConfiguration
并且一切正常。
关于java - Spring WAR 不创建 BuildProperties Bean,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47800298/