File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Spring and the fly likes Bean from one project to another project Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Frameworks » Spring
Bookmark "Bean from one project to another project" Watch "Bean from one project to another project" New topic

Bean from one project to another project

Arpita Shah

Joined: Aug 28, 2009
Posts: 15
Hi All,

I have two Projects I want to use service of one project into another project's service .. Both have different service.xml files .. How can I Refer one Bean into another in this scenario ?? Please help me out on this
pamir sonmez
Ranch Hand

Joined: May 31, 2010
Posts: 47
add other project jar or dependecy to your main project

in your main project application context
while you are importing your own service.xml
also import other project service.xml file

then you can use other project bean as you use them in other project
Arpita Shah

Joined: Aug 28, 2009
Posts: 15
Thanks for your reply.. I am still getting Error saying

Initialization of bean failed; nested exception is org.springframework.beans.TypeMismatchException: Failed to convert property value of type [] to required type [] for property 'rulesProcessor'; nested exception is java.lang.IllegalArgumentException: Cannot convert value of type [] to required type [] for property 'rulesProcessor': no matching editors or conversion strategy found

I have following implementation :

BERulesProcessor is an interface in and its implementation RulesProcessor is in interface is in different project and RulesProcessor is in different project.

I have two service.xml files :

This is the xml file of one project (BE Core ) in which we have imported service.xml file of another project (BE Rules Say)

<import resource="/../../be/rules/service.xml"/>
<bean id="EntityService" class="com.thegoldensource.model.service.BaseEntityService">
<property name="businessEntityReader" ref="EntityMetaObjectReader"/>
<property name="modelReader" ref="ModelMetaObjectReader"/>
<property name="converterFactory" ref="EntityConverterFactory"/>
<property name="parserFactory" ref="EntityParserFactory"/>
<property name="standardObjectFactory" ref="StandardObjectFactory"/>
<property name="transformerFactory" ref="TransformerFactory"/>
<property name="completenessDefinitionProvider" ref="CompletenessDefinitionProvider"/>
<property name="rulesProcessor" ref="BERulesProcessor"/>

and the BE Rules contains service.xml is


<bean id="BERulesProcessor" class=""/>


I have BaseEntityService class in BE Core and I am trying to setter inject the ruleProcessor and getting this error.

please suggest what is doing wrong in this ?
I agree. Here's the link:
subject: Bean from one project to another project
It's not a secret anymore!