【发布时间】:2018-02-22 12:43:59
【问题描述】:
以前我只有一个名为“projectA”的项目。 我在“projectA”中有一个 XML bean 配置文件“service.xml”,bean 的类为“com.home.karoom.impl.adapter”
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-2.5.xsd">
<bean id="<bean id="espAdapter" class="com.home.karoom.impl.adapter">
<property name="writer" ref="writer" />
</bean>
</beans>
现在,我创建了名为“projectB”的新项目并将 bean 类“com.home.karoom.impl.adapter”移动到“projectB”。
现在,“projectA”中不再存在 bean 类“com.home.karoom.impl.adapter”
如何使用“service.xml”引用“projectB”中的新类位置?
【问题讨论】:
-
你是用IDE编译吗?
-
@EugenCovaci 是的,我愿意
-
嗯,spring 2.5 现在已经相当老了,你应该考虑升级。无论如何,xml 文件是在运行时处理的,所以类
com.home.karoom.impl.adapter必须 存在于运行时类路径中的某个位置。常见的方式是它存在于项目中,最终通过一个库 jar。