• 5 Subscribers
  • 114 Views
0

I am new to the world of spring so i may ask a silly question but please let me the solution of my below problem please .

My problem is that I have two projects independent project nae is project A and project B ,now in project A i have the below xml configuration of bean

<bean id="abcService" class="com.jmx.JMXServiceImpl" autowire="no">
        <constructor-arg index="0">
            <ref bean="jobDetailsDomainHome" />
        </constructor-arg>
</bean>

now in project A this bean get initilazied easily now i need this same bean initialized in project B also , so i have added project A in project B classpath also now please advise inside java class named rty of Project Bhow can i call this same bean abcService


1 answers in total

0
jaysee Posted at 2017-01-03 13:36:01Z

The bean abcService depends on bean jobDetailsDomainHome. So there's no way to use abcService without the other bean.

You can split the configuration in various xml files. So define the abcService and the needed beans in one xml file, which is imported by the configurations of project A and project B.

<import resource="classpath*:service-context.xml" />

The import of xml files can use the classpath like shown above. But you can use locations in the file system too.

It's not important which bean is defined in which file as long as every needed bean is defined.

Answer this questsion