Spring MVC – Creating Web Services: One Project or Multiple Projects?

javaspring

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 ?

Best Answer

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.