[英]Jenkin build UnsatisfiedDependencyException: Error creating bean with name
I'm working on a project which is based on Spring Boot ( 2.3.8 ).我正在开发一个基于 Spring Boot ( 2.3.8 ) 的项目。 It's working fine when i build in my local environment.
当我在本地环境中构建时,它工作正常。 But I'm getting
UnsatisfiedDependencyException: Error creating bean with name
when i build the same app through jenkins.但是当我通过 jenkins 构建相同的应用程序时,我得到了
UnsatisfiedDependencyException: Error creating bean with name
。
Local Env:本地环境:
Server Env:服务器环境:
The UnsatisfiedDependencyException means that you are missing injecting a Dependency in one of your Components. UnsatisfiedDependencyException 意味着您缺少在其中一个组件中注入依赖项。 When using @Autowired or Constructor based injection you need to initialize all the beans that you wish to Autowire in a Service or a Component.
使用 @Autowired 或基于构造函数的注入时,您需要初始化所有希望在服务或组件中自动装配的 bean。
In your case since its working on you local means that Jenkins is having a different profile running than that on your local.在您的情况下,因为它在您本地工作意味着 Jenkins 运行的配置文件与您本地的配置文件不同。 Check what profile are you starting the App on local.
检查您在本地启动应用程序的配置文件。 If its tests that are failing in Jenkins then check running on local with the tests profile in spring.
如果其测试在 Jenkins 中失败,则使用 spring 中的测试配置文件检查在本地运行。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.