Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Does Spring MVC support JSR 311 annotations?

While helping out someone else, I noticed they were trying to do Spring development using the @GET, @Consumes, and @Path annotations. It is my understanding that these annotations come from the JSR-311 specification.

I simply suggested that they use the Spring @RequestMapping annotation for mapping endpoints to their controller, but it made me curious as to whether or not Spring MVC (any version) supports JSR 311?

like image 909
nicholas.hauschild Avatar asked Sep 22 '11 16:09

nicholas.hauschild


People also ask

Does spring MVC use JAX-RS?

The Spring Framework is a full framework that allows you to create Java enterprise applications. The REST capabilities are provided by the Spring MVC module (same module that provides model-view-controller capabilities). It is not a JAX-RS implementation and can be seen as a Spring alternative to the JAX-RS standard.

Is spring MVC still used?

@PanadolChong accomodate Spring MVC is still used in some legacy applications, and Spring boot does majority of the configurations under-hood so to have a better understanding of how things work internally, Spring MVC might help.

What is difference between jersey and spring REST?

Jersey is the JAX-RS API example implementation provided by Sun, while Spring REST is of course Spring's implementation of the same API/JSRs. The major difference is that Spring REST easily integrates into other Spring APIs (if you wish) such as Spring Data Rest.


1 Answers

Short answer: NO. To quote Juergen Hoeller:

We're considering integration with JAX-RS on a separate basis - separate from Spring MVC's own endpoint model -, possibly supporting the use of Jersey (the JAX-RS RI) with Spring-style beans in a Spring web application context. This might make Spring 3.0 as well, depending on the finalization of JSR 311 and Jersey in time for Spring 3.0 RC1. Otherwise it would be a candidate for Spring 3.1.

However I haven't found such a support neither in 3.0 nor in 3.1.

Of course you can integrate frameworks like Apache CXF and use standard JSR-311 annotations. Spring MVC itself does not recognize these annotations.

like image 62
Tomasz Nurkiewicz Avatar answered Sep 20 '22 18:09

Tomasz Nurkiewicz