OK I managed to do some more work on getting Fabric3 to play well with Spring Boot based on suggestions by Teemu and Tomas. Sorry for the delay but we've had a lot of work on projects recently.
I used the previous work that was done on the Fabric3 Node runtime and fortunately it will integrate nicely with the way Spring Boot expects things to work. I don't have everything working yet but I have started on a sample repo (based on Gradle but the Maven equivalent should work as well) here:
The developer workflow is as follows:
1. Create a project using the Gradle Application plugin (later I will change this to the Spring Boot plugin, see below).
2. Add the following core dependencies to your project:
compile group: fabric3Group, name: 'fabric3-node', version: fabric3Version , transitive: false
compile group: fabric3Group, name: 'fabric3-node-extensions', version: fabric3Version, transitive: false
These will place two archives (a Jar and Zip) in the application /lib directory. Transitive is important so the app plugin does not pull down the entire dependency tree. The two archives contain all of the core dependencies required to boot F3. I like this approach because it avoids polluting the /lib directory with tons of Jars and also provides classpath isolation from the application classes.
3. Add any profiles you want to configure the runtime with to your project:
compile group: fabric3Group, name: 'profile-rs', version: fabric3Version, classifier: 'bin', ext: 'zip'
This will add the RS profile Zip to the /lib directory.
4. Create a Main class and configure your project to use it:
mainClassName = 'org.fabric3.samples.node.StartSample'
The main class can boot the runtime, use the DSL (or composites) to deploy services or dynamically wire to services. For example:
public static void main(String... args) throws Exception {
Fabric fabric = Bootstrap.initialize();
fabric.addProfile("rs"); // enable the REST profile
fabric.start();
Domain domain = fabric.getDomain();
domain.deploy("Foo", new FooServiceImpl());
FooService service = domain.getService(FooService.class);
service.hello();
fabric.stop();
}
----------------------
After that is complete, the main class can either be launched from the command line using the app start script created by Gradle or from within the IDE.
For next steps, I plan on following:
1. Get the above setup working in a single JAR file using the Spring Boot plugin
2. Integrate Fabric3 into Spring application contexts so Spring can transparently inject SCA proxies into beans without having to use SCA annotations.
3. Create Spring bean post-processors so that Spring Beans annotated with SCA annotations will be enabled. For example, enable a service endpoint over REST, ZeroMQ, etc.
4. Integrate the Spring Boot embedded Servlet container with the Fabric3 node runtime so Fabric3 can transparently export service endpoints (required for above).
I'm hoping this will make the development experience very simple. Let me know your thoughts.
Jim