JAX-RS annotations - jersey

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.

Related

Integrating Helidon with spring boot

Using rest service using Helidon
Have created app using Helidon and rest services are available from Helidon.
i want to use spring jdbc template,dao Autowire features with Helidon and searched lot didn't find any article first of all is it right way ? Please suggest docs links
Spring and Helidon are alternative frameworks indented for (mostly) the same purpose. They are two different worlds that will have problems coliding.
I don't think it's impossible to combine them, but it is at least impractical and bound to bring lots of problems like bean instantiation, classloader and so on with them.
I'd recommend you choose one of the two and stick with it.
Helidon is not Spring so does not support these features. It sounds like you want to write a Spring application instead.

How to integrate the spring boot project generated by swagger with OSGi and deploy it in Apache karaf?

How to integrate the spring boot project generated by swagger with OSGi and deploy it in Apache karaf?
How should I write my pom.xml and how to modify the startup class. If there is something not detailed, I will add it. Thank you!
You don't. It's not strictly impossible but it would be a lot of work and struggle and you will not get any benefits out of it.
If you want SpringBoot - stick to that. You will sacrifice modularity, strong encapsulation, enforced clean architecture and bunch of other architectural thing that will matter a lot in the long run. But you will gain something that is easy to work with in the beginning and tons of code to copy/paste.
If you are playing the long game - I'd recommend to forget about SpringBoot and learn how to build modular OSGi applications. Recent version allow you to use popular technologies like JAX-RS and CDI. You can probably use one of the Swagger's JAX-RS generators and then convert the outcome to proper modular code. It may even be that there is a generator that generates OSGi JAX-RS code already.

What's the "official" way to integrate Spring into OSGI

long time ago I have already been working with Spring in an OSGI context. At this time there was a subproject called Spring Dynamic Modules being the first address for an integration of the two frameworks.
Coming back to the scene some years later the situation is not clear anymore (for me). Spring Dynamic Modules has migrated to Blueprint and there are 2 major implementations Aries and Gemini where the first one seems to be more in competition with Spring than complementing it and the latter seems to be small and with very rare release cycles.
The official Spring page has no documentation at all any more concerning OSGI.
So can anyone with a better standing / know how in Spring help and tell me what's currently (11/2014) the "official" or preferred way to integrate Spring applications into an OSGI environment?
Many thanks & best regards
Rabe
Official according to whom? There is nobody qualified to give an "official" answer on this, there are only common practices.
As you note, the Eclipse Gemini implementation of Blueprint is abandonware. The Apache Aries implementation is a live project though, and it is not so much in competition with Spring as a clean-room implementation of the Blueprint specification without reference to the old Spring source code.
As such, I recommend migrating to the Aries Blueprint implementation as the most practical and sensible way forwards.
Spring does not officially support OSGi nowadays. Spring EBR repository was closed (I guess as they had said they would close it) and some company took over the content in Virgo EBR repo. I do not know if it is still alive.
If you have a choice, do not use Spring within OSGi. It is a great technology, but it was designed to work well in monoholitic systems. There is a good blog post why not to use Spring, blueprint and similar technologies within OSGi: http://blog.osgi.org/2014/09/how-should-i-use-guicespringblueprint.html

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

JSR330 DI vs. Spring DI

Why are people using Spring DI vs. JSR330 DI? I see many projects still going forward at a huge speed with spring DI oblivious to the JSR330 specification. Many don't even know it exists. Was it not marketed enough and spring was?
I do see posts of Guice vs. spring, but the real argument should be JSR330 vs. spring since spring does not implement the spec yet(and hopefully one day it will). Any ideas on why such a large portion of the community seems oblivious to JSR330 and not evolving to it?
NOTE: I should make a correction here. Spring 3.0 does implement JSR330 and even has a way to override the default bindings much like guice except you have to supply an xml file instead of a Module file written in java.
I would say it is because Spring is so much more than just a simple DI container. Many teams use Spring for these other various reasons:
Transaction Management
Security
MVC
Aspects
Data Access
Batch processes
Webflow
Web Services
Many others...
They have their hands in so many things that it just makes it easy mix and match Spring technologies to do general enterprise development.
Spring 3.X supports JSR-330 out fo the box - http://blog.credera.com/topic/technology-solutions/java/springone-2gx-2011-summary/
It means that you can use the spring annotations or the JSR-330 ones.

Resources