nicholas
nicholas

Reputation: 2772

Spring Application Context Import

I have a Project A (Spring Web) and would like to import into another project such as

  1. Web Project
  2. Desktop Project

How to do it ? Please help. Thanks.

Upvotes: 2

Views: 5612

Answers (1)

Marcel Stör
Marcel Stör

Reputation: 23565

You cannot import "projects" as such. You can make a JAR available as a dependency for a project and then import Spring configurations (i.e. application context) from the JAR into Spring configurations of your project.

Example

Project A compiled into a.jar with a-context.xml in the root folder of a.jar. Then in project-context.xml in your project you place

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

Your case

In your case this does not make much sense. I assume the web project is compiled into a WAR file? Then you have lots of dependencies that are superfluous if used in a desktop application. Hence, you should extract a common project that is compiled into common.jar which can be used as a dependency from both projects.

Upvotes: 5

Related Questions