I have devloped a spring rest-api. packaging it as a war and deploying the same works fine. what has to be done if need to package it as jar. First of all is that correct, if yes, then how to do so. Please help.
If you are using Maven, just create another project module and move these REST-API classes to that module. The only difference between these classes and "regular" java classes is that they are annotated.
You can still throw the JAR to the classpath and set the package to the "component-scan" directive as a base-package.
You need to use this module together with the main application anyway I suppose.