如何将一个项目的spring-config.xml导入另一个项目的spring-config.xml? [英] How to import spring-config.xml of one project into spring-config.xml of another project?
问题描述
我有两个名为 simple-core-impl
和 simple-core-web
的项目。
I have two projects with the name simple-core-impl
and simple-core-web
.
这两个项目都是基于春天的
,两者都有一个父项目名称 simple-core
。
Both projects are spring based
and both have a parent project name simple-core
.
我在中有
项目和 simple-impl-config.xml
simple-core-impl simple-web-config.xml
在 simple-impl-config.xml
中。
I have simple-impl-config.xml
in simple-core-impl
project and simple-web-config.xml
in simple-impl-config.xml
.
我有一个bean,它有类:简单服务
哪个有一个方法可以给我回复一条消息hello World 。
I have a bean which has class: simple service
which have one method which returns me a message "hello World".
我想在中导入
所以bean可以进入我的控制器,该控制器位于 simple-impl-config.xml
简单 - web-config.xml simple-core-web
项目中。
I want to import the simple-impl-config.xml
in the simple-web-config.xml
so the bean is available into my controller which is in simple-core-web
project.
simple-core-web
项目有一个 jar-simple-core-impl
项目。
所以请告诉我如何将一个项目的 spring-config.xml
导入<$ c $另一个项目的c> spring-config.xml 所以第一个bean只能通过导入进入其他项目吗?
So please tell me how I can I import spring-config.xml
of one project into spring-config.xml
of another project so all the beans of first is available into other project by just importing?
我不知道想要重写所有bean。
I do not want to rewrite all the beans.
推荐答案
<import resource="classpath:spring-config.xml" />
参考:
- 编写基于XML的配置
元数据 - 资源(这里是
类路径:
部分已解释)
- Composing XML-based configuration metadata
- Resources (here the
classpath:
part is explained)
这篇关于如何将一个项目的spring-config.xml导入另一个项目的spring-config.xml?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!