加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

自己创建的项目中无法使用组织子系统类中的方法

发布时间:2020-12-16 06:32:44 所属栏目:百科 来源:网络整理
导读:1.问题描述 我在一个名为opf的项目中引入了组织系统除了web层之外的所有jar包 在opf的应用层想使用EmployeeFacade接口的方法,因此在调用它的应用层类中加入了以下代码 @Inject private EmployeeFacade employeeFacade; 可以opf项目在启动过程中报以下错误:

1.问题描述

我在一个名为opf的项目中引入了组织系统除了web层之外的所有jar包
在opf的应用层想使用EmployeeFacade接口的方法,因此在调用它的应用层类中加入了以下代码
@Inject
private EmployeeFacade employeeFacade;

可以opf项目在启动过程中报以下错误:

Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.openkoala.organisation.facade.EmployeeFacade] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@javax.inject.Inject()}


2.问题解决

通过另外创建一个项目,勾选集成组织子系统(非源码集成),对比配置文件后发现问题在如:

自己建的项目的conf模块下的base-context.xml配置有问题,没有把org.openkoala路径加进去,所以对应的类没有自动注入。
原配置:

<context:annotation-config/>
<context:component-scanbase-package="com.shanlan">
<context:exclude-filtertype="annotation"
expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<context:property-placeholderlocation="classpath:META-INF/props/.properties"ignore-unresolvable="true"/>


改后的配置:

<context:annotation-config/>
<context:component-scanbase-package="org.openkoala,com.shanlan">
<context:exclude-filtertype="annotation"
expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<context:property-placeholderlocation="classpath:META-INF/props/.properties"ignore-unresolvable="true"/>

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读