简体   繁体   中英

In a maven multi-module project, how to access the spring beans from one module to another

I have a maven multi-module application as below

parent
-+ module 1
-+ module 2
-+ module 3

Module 2 and module 3 are seperate jars and added as depencency in module 1.

All the modules have application-context assigned to it.

I need to get the spring beans from module 3 and module 2 to module 1.

Please help

in case you are using spring with xml configuration files you should import module 2 and module 3 application-context files in the module 1 application-context like below :

<import resource="classpath*:file/location/module1application-context.xml" />
<import resource="classpath*:file/location/module2application-context.xml" />

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM