Migrating from Spring-DM & Spring 3 to Blueprint & Spring 4 on Karaf

1.5k Views Asked by At

I have legacy app written in Java 7 using Spring 3.2.18 that runs on Karaf 2.4.4 together with Spring-DM. I plan to move to newer versions of Spring, Java and Karaf.

I know that spring-dm is unsupported and I should move to Blueprint, but I'm not sure if I could then load OSGI beans in Spring context like spring-dm does. Does Karaf 2.4.4 supports it?

I would like not to change source code too much and still use @Autowired as I use right now.

As first step I plan to replace spring-dm with blueprint, next step would be to upgrade Spring 3 to Spring 4. Is it valid approach?

1

There are 1 best solutions below

7
Cλstor On

Karaf by default uses Aries Blueprint, which does not supports spring beans at all, however you can use blueprint-maven-plugin, which creates a blueprint.xml file from annotated classes.

But if your code has a strong dependency with Spring, like SpringMVC to provide servlets, you can use Gemini Blueprint , which is the successor of Spring-DM and suports Spring up to version 4.3.x, but i must warn you, it can be tricky to make it work on karaf, specially if you use SpringMVC.