Alina
Alina

Reputation: 369

Import some classes from another war file deploy on same server

I have a java web application which is deployed on tomcat server. Then I have another application which contain webservice using spring oauth2. This also is deployed on the same tomcat server. The webservice application use the same dao /service and model classes as the java web application. Currently I have replicate the classes in the webservice. If there is a change, I need to replicate it on both side. I'm asking if is there a way to call the dao/model classes from the java web application into the webservice application (without duplicate the classes on both side) ?Both projects is using maven.

Upvotes: 0

Views: 418

Answers (1)

J Fabian Meier
J Fabian Meier

Reputation: 35805

If the same set of classes is needed in two applications, put these classes into a separate jar, deploy it with Maven and put it as dependency into the poms of the Maven projects that use it.

Upvotes: 1

Related Questions