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

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-scan base-package="com.shanlan">
<context:exclude-filter type="annotation"
expression="org.springframework.stereotype.Controller"/>
</context:component-scan>
<context:property-placeholder location="classpath:META-INF/props/.properties" ignore-unresolvable="true"/>


改后的配置:

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


转载于:https://my.oschina.net/albertjun/blog/362351

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值