Spring gives RESTful WS implementation OR only a wrapper over implementations - spring

Spring gives RESTful Web Service implementation or provides only a wrapper to implementations like jersey,etc.
I am asking this question, as I have NOT see this nature in some of the POC codes on internet.
But heard and read a lot that Spring is all about wrappers (apart from IOContainer and AOP) like HibernateTransactionManager
Edit : 1st Dec'14
All in all, what I want to understand is : who will going to give the implementation for annotations like #RequestMapping

Spring's REST implementation is independent from other implementations. It is based on Spring MVC with some additional annotations. Note however that it is not an JAX-RS protocol implementation like frameworks like Jersey, Apache CXF and RESTEasy are.

Related

Spring vs JAX-RS

Here, several questions have been asked by many developers about difference between Spring-Rest and JAX-RS.
And, I have also learned that Spring is not following any specification and Spring framework has their own implementation then
Why Spring allows all that Annotations which are supported/used by JAX-RS by default?
Spring does not support JAX-RS annotations. If there is a situation where you think they do, then you are mistaken or it's just a coincidence. Period. If you will add any JAX-RS annotations in my Spring MVC program, nothing will happen. Annotations are just metadata. They are not programs. If Spring does not recognize the metadata, it will ignore it. But if you use a JAX-RS annotation in place of a Spring annotation that is used for the same purpose, respective of their framework, then you will not get the expected Spring behavior. So basically, if you are using Spring MVC, remove any JAX-RS dependencies so you don't mistakenly use them.

Is Spring Rest the implementation of JAX-RS or what implementation does Spring Rest use for REST support?

I know JAX-RS has many implementations like RESTEASY,Jersy,RestLet.But when i use Spring boot project i just need to add Spring-web dependency and i am ready to go for creating REST APIs.I want to know what is the implementation Spring Boot Rest uses to support REST ?
Difference between JAX-RS and Spring Rest
hope that solves your problem or makes it a little clearer.

RESTful web service

I am implementing a REST service from scratch. I am using Spring + ibatis for the same.
Now, spring offers REST support using annotations. However, online, I find many tutorials to integrate Jersey with Spring.
My question: Why would one want to introduce extra dependencies by including another framework, that is Jersey JAX-RS, when Spring itself is good?
You assume that there's a problem with introducing "another" dependency, which, unless you're developing for some tiny embedded system, there isn't. The added memory footprint, complexity etc would generally be irrelevant.
The decision to use Spring or Jersey for RESTv implementation should be one of personal preference and suitability. Pick the one that satisfies your requirements and you're most comfortable with.
Also, using Spring for REST will require additional dependencies itself. If you're only using Spring for dependency injection, you won't require spring-web or spring-webmvc, whereas these will be required for REST.
Hope this helps

JAX-RS annotations

I want to learn Restful web service using Apache CXF. Could you please suggest any resource to refer to except for the official CXF site? Where can I learn all those annotations with example uses?
One more question is “Are those annotations going to be different depending on the implementations framework like apache CXF or Jersey or any other framework?”
Are those annotations going to be different depending on the implementations framework like apache cxf or jersey or any other framework?
No. The point of the JAX-RS standard (and the rest of Java EE) is exactly to ensure the annotations work the same across implementations. Of course, there will always be bugs and differences in interpretation that result in different behavior, but in general it tends to work pretty well.
However, there may be additional, implementation-specific annotations that provide desirable functionality that is not covered by the standard (there's quite a lot of these for EJB and JPA implementations, not sure about JAX-RS). Using those would make your app depend on that particular implementation.
Check out Jersey user guide - it has a section on JAX-RS, which explains these annotations and should work with any other JAX-RS implementation: http://jersey.java.net/nonav/documentation/latest/jax-rs.html
Apache CXF documentation is very useful and it provides lots of additional resources. Consider going through it and checking the examples.
Additionally it might be useful for you to go through some JAXB tutorials and resources.

What is the best way to have interceptors for POJO?

EJB 3.0 comes with the concept of Interceptors, but then again they are applicable to EJBs only. My project requires developing Interceptors for POJO classes. One option for this is to use Spring AOP. I want to know if it's worth the overhead of including the libraries such as commons-logging, spring-aop, cglib that are required for Spring AOP.
Spring is much more than Spring AOP, and you can not use Spring AOP without Spring, and I am talking not only to the Spring libs, but to the Spring programming model too!
So if you think Spring is useful for your application (believe me, it is very useful to many application), then you can use it. - But it is a complete programming model, like EJB, not only a lib or a simple framework.
But I think every modern not trivial application should have a ICO container, so Spring is one of the choices you have.
Sure, it's worth, but be aware it won't be enough if you need to have interceptors for you POJOs : You will also need a "spring agent" to be passed as an argument to your jvm ("Load-Time Weaving"), or you won't be able to intercept your pojos methods, or you will have to use "Compile-Time Weaving".
In short : POJOs have to be created via Spring for them to be "interceptable".
CTW (or LTW) makes compilation (or startup) quite slower.

Resources