How to make 2 spring projects share the same code base

Miciurash

I have 2 web projects in Spring MVC that are similar and have the same services and models. I want to split the code in order to have a common CORE.

I created a new project (CORE) with all the services and models that are shared and exported it as jar as specified here (Auto-wiring annotations in classes from dependent jars) but the components are not scanned and auto-wired in CHILD projects.

So, my questions are:

What are the other options besides jars to make the auto-wire happen?

What is the best practice to split code base and share the core components in spring projects?

Neil McGuigan

Something like the below. See http://books.sonatype.com/mvnex-book/reference/multimodule.html for more info.

Maven parent module /pom.xml:

...
<groupId>com.example</groupId>
<artifactId>parent</artifactId>
<version>X.X-TAG</version>
<packaging>pom</packaging>
<modules>
<module>core</module>
<module>child1</module>
</modules>
...

Maven core module: /core/pom.xml:

...
<parent>
<artifactId>parent</artifactId>
<groupId>com.example</groupId>
<version>X.X-TAG</version>
</parent>
<packaging>jar</packaging>
<artifactId>core</artifactId>
...

Maven child1 module: /child1/pom.xml:

...
<parent>
<groupId>com.example</groupId>
<artifactId>parent</artifactId>
<version>X.X-TAG</version>
</parent>
<packaging>war</packaging>
<artifactId>child1</artifactId>
<dependencies>
<dependency>
    <groupId>${parent.groupId}</groupId>
    <artifactId>core</artifactId>
    <version>${parent.versionId}</version>
</dependency>
</dependencies>
...

この記事はインターネットから収集されたものであり、転載の際にはソースを示してください。

侵害の場合は、連絡してください[email protected]

編集
0

コメントを追加

0

関連記事

分類Dev

How do you share code between projects/solutions in Visual Studio?

分類Dev

How to make two Application Modules share the same entity cache?

分類Dev

How to create multi module project in maven ? so that all the code base of child projects can be in parent one

分類Dev

How do I configure mix.exs to make umbrella project apps share the same version?

分類Dev

How to make buttons execute the same code but with different variables accordingly?

分類Dev

What is the best practice for using git on multiple projects with the same base?

分類Dev

iOS - 2 projects in a workspace and referencing the same files - how to determine which project I am in?

分類Dev

How do I store projects that share a common shared driver on Git

分類Dev

How to agregate integerfield in django template if 2 model share the same field's value?

分類Dev

MATLAB: How to make 2 histograms have the same bin width?

分類Dev

How to use the same code base to create another project with some shared services and components?

分類Dev

How can I make 2 strings with the same word(s)/meaning, but with Unicode differences hash to the same id?

分類Dev

How to share code in JavaScript Azure Functions?

分類Dev

When clicked on button, how can i make the returned message appear on the same page without other code?

分類Dev

How to find the count of workers working on the exact same projects

分類Dev

How to have prod and dev Firebase projects with the same Auth configurations?

分類Dev

How to make bar graph of 2 variables based on same DataFrame and I want to choose 2 or until 5 data

分類Dev

How to Make a local repo for a list of git projects of AOSP ,

分類Dev

How to share the same Resharper settings between multiple solutions, with no manual intervention?

分類Dev

How to share putty session/screen with others in same network?

分類Dev

How can I make Files search recursively within a network share?

分類Dev

How to make my app appear in share list in vue native?

分類Dev

Spring JPA: How to update 2 different tables in 2 different `DataSource` in the same request?

分類Dev

How to find all Code Reviews across Projects and Collections in TFS?

分類Dev

Material UI make 2 elements the same height

分類Dev

Do 2 objects creating serial queues with the same name share the same queue

分類Dev

kotlin how to share common retrofit response handler code

分類Dev

How do I share code across a test run in rspec?

分類Dev

SignalR Hub in App_Code causes "Two Hubs must not share the same name" error

Related 関連記事

  1. 1

    How do you share code between projects/solutions in Visual Studio?

  2. 2

    How to make two Application Modules share the same entity cache?

  3. 3

    How to create multi module project in maven ? so that all the code base of child projects can be in parent one

  4. 4

    How do I configure mix.exs to make umbrella project apps share the same version?

  5. 5

    How to make buttons execute the same code but with different variables accordingly?

  6. 6

    What is the best practice for using git on multiple projects with the same base?

  7. 7

    iOS - 2 projects in a workspace and referencing the same files - how to determine which project I am in?

  8. 8

    How do I store projects that share a common shared driver on Git

  9. 9

    How to agregate integerfield in django template if 2 model share the same field's value?

  10. 10

    MATLAB: How to make 2 histograms have the same bin width?

  11. 11

    How to use the same code base to create another project with some shared services and components?

  12. 12

    How can I make 2 strings with the same word(s)/meaning, but with Unicode differences hash to the same id?

  13. 13

    How to share code in JavaScript Azure Functions?

  14. 14

    When clicked on button, how can i make the returned message appear on the same page without other code?

  15. 15

    How to find the count of workers working on the exact same projects

  16. 16

    How to have prod and dev Firebase projects with the same Auth configurations?

  17. 17

    How to make bar graph of 2 variables based on same DataFrame and I want to choose 2 or until 5 data

  18. 18

    How to Make a local repo for a list of git projects of AOSP ,

  19. 19

    How to share the same Resharper settings between multiple solutions, with no manual intervention?

  20. 20

    How to share putty session/screen with others in same network?

  21. 21

    How can I make Files search recursively within a network share?

  22. 22

    How to make my app appear in share list in vue native?

  23. 23

    Spring JPA: How to update 2 different tables in 2 different `DataSource` in the same request?

  24. 24

    How to find all Code Reviews across Projects and Collections in TFS?

  25. 25

    Material UI make 2 elements the same height

  26. 26

    Do 2 objects creating serial queues with the same name share the same queue

  27. 27

    kotlin how to share common retrofit response handler code

  28. 28

    How do I share code across a test run in rspec?

  29. 29

    SignalR Hub in App_Code causes "Two Hubs must not share the same name" error

ホットタグ

アーカイブ