You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@felix.apache.org by kentsang77 <ke...@gmail.com> on 2018/02/15 01:29:02 UTC

apache felix and spring integration

Hi all, 

I am new to apache feilx and tried the dictionary, spell checker and draw
shape tutorials.

I have a very large spring base backend application. There are around 500
spring beans inside.

They are mainly service handlers, DAOs and some beans for business logic.

Server 
-> Dispatcher (routing requests to handler) 
-> Service Handler (handle the request and reply response) 
-> DAOs (database insert / update / delete) / business logic beans

Most service handlers have DAO / business logic bean injected. DAO and
business logic beans are shared by many service handlers as singleton bean.

Now I want to restructure some handlers as osgi bundles and the Server act
as a osgi host.

Is apache felix an appropriate framework for spring bean + osgi bundle? Any
example on integrating spring base application with apache felix?

Regards,
Ken



--
Sent from: http://apache-felix.18485.x6.nabble.com/Apache-Felix-Users-f4833200.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org


Re: apache felix and spring integration

Posted by Christian Schneider <ch...@die-schneider.net>.
It is possible to migrate a spring based application to OSGi but do not
underestimate the effort.

For old spring applications plain blueprint might be a good alternative as
it is very similar to spring xml.
In a modern spring application you use a lot of annotations though. For
this case you can take a look at the blueprint-maven-plugin (
http://aries.apache.org/modules/blueprint-maven-plugin.html). It parses
spring or jee annotations at build time and creates the blueprint xml on
the fly. I helped migrate a mid sized spring application to apache karaf
this way.

Stay away from spring-dm though it is not maintained since ages.

You can embed OSGi into an existing application but it will make a lot of
things only much harder. So I am not sure if this is a good idea. What we
did for the migration was to use the blueprint-maven-plugin above to create
blueprint while still keeping the spring contexts. This way we were able to
use the same jars in plain spring and OSGi. This is a bit tricky to do but
can help you if you do not have time to stop development and just do the
migration.

In any case keep in mind that OSGi requires good modularization of your
existing app. If you have nice modules as jars and each module only uses a
designated API to talk to other jars then you will have fun with OSGi. If
your beans use other impl classes directly then it can be a pain to bring
this to OSGi as is.

So the first step should be to have clean module boundaries in plain spring
and ideally check them using an architecture tool. If this is in place then
migration to OSGi is rather easy.
... and if at some point you decide you do not need /want OSGi you at least
have improved your application a lot already :-)

Christian



2018-02-15 2:29 GMT+01:00 kentsang77 <ke...@gmail.com>:

> Hi all,
>
> I am new to apache feilx and tried the dictionary, spell checker and draw
> shape tutorials.
>
> I have a very large spring base backend application. There are around 500
> spring beans inside.
>
> They are mainly service handlers, DAOs and some beans for business logic.
>
> Server
> -> Dispatcher (routing requests to handler)
> -> Service Handler (handle the request and reply response)
> -> DAOs (database insert / update / delete) / business logic beans
>
> Most service handlers have DAO / business logic bean injected. DAO and
> business logic beans are shared by many service handlers as singleton bean.
>
> Now I want to restructure some handlers as osgi bundles and the Server act
> as a osgi host.
>
> Is apache felix an appropriate framework for spring bean + osgi bundle? Any
> example on integrating spring base application with apache felix?
>
> Regards,
> Ken
>
>
>
> --
> Sent from: http://apache-felix.18485.x6.nabble.com/Apache-Felix-Users-
> f4833200.html
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
> For additional commands, e-mail: users-help@felix.apache.org
>
>


-- 
-- 
Christian Schneider
http://www.liquid-reality.de

Computer Scientist
http://www.adobe.com

Re: apache felix and spring integration

Posted by kentsang77 <ke...@gmail.com>.
Thanks to your quick reply.

I like felix embedded mode as it can be easily integrated into my
application.

Karak is a container and I found this:
http://karaf.922171.n3.nabble.com/embedding-karaf-td4028257.html

Saying that embedding a container doesn't make sense at all.

from the latest karaf document, it says 
"It also supports the "run anywhere" (on any machine with Java, cloud,
docker images, …​) using the embedded mode."

https://karaf.apache.org/manual/latest/

Any solid example on showing how to embed karaf?

Karaf wiki page show TODO for embedding Karaf

https://cwiki.apache.org/confluence/display/KARAF/6.4.+Embedding+Karaf






--
Sent from: http://apache-felix.18485.x6.nabble.com/Apache-Felix-Users-f4833200.html

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@felix.apache.org
For additional commands, e-mail: users-help@felix.apache.org