如何将一个项目的spring-config.xml导入另一个项目的spring-config.xml? [英] How to import spring-config.xml of one project into spring-config.xml of another project?

查看:466
本文介绍了如何将一个项目的spring-config.xml导入另一个项目的spring-config.xml?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有两个名为 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".

我想在中导入 simple-impl-config.xml 简单 - web-config.xml 所以bean可以进入我的控制器,该控制器位于 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" />

参考:

这篇关于如何将一个项目的spring-config.xml导入另一个项目的spring-config.xml?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆