crig crig - 1 month ago 8
reST (reStructuredText) Question

Spring Boot based RESTful service in JBOSS Fuse

I am new to JBoss Fuse and the stack of Karaf, Camel, Fabic8, CXF.

I'd like to deploy a simple restful service to JBoss Fuse (6.2.1).

I'd like to ideally use Spring Boot, since it makes development/testing easier on standalone dev boxes (can boostrap servlet container, etc).
I'd additionally like to minimize as much as possible (or eliminate) any XML configuration beyond the Maven POM.
So Spring Java Configuration instead of XML configuration.
I'm open to using either Spring-MVC or Jax-RS/CXF for the service.

Is this achievable and a "good" course to take?

I cannot seem to find any workable examples that are similar. Can someone point me to an example or offer some tips to get going with this? I'm already familiar with Spring/Spring-MVC/Jax-RS in general. But between Karaf/Camel/Fabric8/OSGi, various deployment options, etc., I'm spinning in circles and having trouble getting started.

Thanks!

Just to clarify, this is for JBOSS Fuse on Karaf, not Fuse EAP.

Answer

I dont think this is achievable, and if it is, it probably shouldn't be.

Firstly, Java config:

Sure, you can have Spring java annotations with your Camel components on Fuse, bearing in mind that Fuse 6.2 utilises spring 3.2, so you are pretty much stuck with whatever support for Java config that provides. I haven't tried this but would definitely endorse it.

Secondly, Fuse and Spring Boot:

In terms of Spring Boot, Fuse and spring boot are not really compatible as they are both containers for running your application (The scope of the Fuse container is much wider than spring boot, but fundamentally they both want to be managing the execution environment for your application).

What to do?

If you just want to run a REST web service and don't require any of the other Fuse 'benefits', then Spring Boot is a very capable container for your services and you can just chuck out all the Fuse stuff (although you could utilise Camel and AMQ just by using the java libraries within your application).

If you need to use Fuse as your execution environment then you really don't want to use spring boot. Presumably there's a need for OSGI, Fabric and so on so you need to wear the Fuse straight jacket. For REST endpoints, I would look at the camel-rest component, however if you really want to use jax-rs JSR311 resource bindings then it's described in the camel docs, although I have not tried this using Fuse (6.2 uses camel 2.15 so this should work).

To throw another spanner in the works, I've had a great time recently using dropwizard as a container for my REST services, which heavily utilises Jax-RS and jersey (which I prefer to the horror of CXF configuration) and doesn't do as much magic auto configuration as spring boot.

Comments