0

Using spring mvc to create a restful api, Maven is build tool and tomcat with spring jars is deployment .

Plan A: each webservice will be its own separate war file/project ? if required I would supply dependices as jar(s) (such as any dao's/dto's/service layer classes used in different webservices? I would share the spring jars between projects from with tomcat lib directory.

Plan B: Have one large project with different controllers (and subsequent request mappings for restful api) added when needed. Supply the spring dependices with project in maven.

Which is better ? I'm aware spring is not jax-rs compliant - what does this mean in practice, whats the difference if not compliant ?

2 Answers 2

1

It depends on how you want these web services to scale. For example, if your 4 GET calls are called 1 million more times per day than the 1 PUT request, then you'll want to split them out so you can load balance them more easily.

1

The first option is good if you might deploy to different boxes in the future, for example on a high traffic site you may want each API in a separate machine or cluster. Otherwise it's just a pain so for small projects just put it all in one war file.

2
  • why is it a pain ? Commented May 6, 2012 at 18:17
  • its just extra setup and complexity for nothing. You'd be creating a multi-pom project with dependencies between the projects. But all the jars and wars would ultimately deploy on one tomcat box. So it makes more sense to deploy as a single war unless there's a compelling reason to split it up (e.g. the endpoints are going to deploy to different boxes).
    – Kevin
    Commented May 6, 2012 at 23:22

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.