我是使用微服务架构的新手,想要从另一个使用 camunda(只读业务流程工具(库))的模块访问 bean。错误未满足的依赖关系来自 camunda 接口(interface),但我在当前模块中不需要来自 camunda 的任何 bean,因此我尝试使用以下代码排除它:
@Configuration
@ComponentScan(basePackages = {"com.example"}, excludeFilters={
@ComponentScan.Filter(type=FilterType.ASSIGNABLE_TYPE, value=SpringProcessEngineServicesConfiguration.class)})
当前模块不会开始提供以下堆栈跟踪:
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'org.camunda.bpm.engine.spring.SpringProcessEngineServicesConfiguration': Unsatisfied dependency expressed through field 'processEngine': Error creating bean with name 'processEngineFactoryBean': FactoryBean threw exception on object creation; nested exception is org.camunda.bpm.engine.exception.NotValidException: Filter name must not be null or empty: name is null; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'processEngineFactoryBean': FactoryBean threw exception on object creation; nested exception is org.camunda.bpm.engine.exception.NotValidException: Filter name must not be null or empty: name is null
最佳答案
我的解决方案很简单,尽管花了很长时间才解决。我设法用下面的代码解决了这个问题:
<exclusions>
<exclusion>
<groupId>org.camunda.blablabla</groupId>
<artifactId>*</artifactId>
</exclusion>
</exclusions>
所需要做的就是排除模块依赖项部分中的所有 camunda 依赖项。傻我啊!
关于java - UnsatisfiedDependencyException bean 名称错误 通过字段表达的依赖关系不满足,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45600275/