You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@karaf.apache.org by Richard Snowden <ri...@gmail.com> on 2014/09/18 10:53:29 UTC

Spring vs Blueprint

Hi all,

I just played around a little bit creating and consuming OSGi services.
First with Blueprint and then with Spring. It seems there's no big
difference between those two.

For me (as a beginner in OSGi / Karaf) Blueprint context files look smaller
and cleaner, so I'd like to focus my efforts on Blueprint and forget about
Spring. Is this a bad idea?

What is the main difference between Spring and Blueprint?

Regards,
Richard

Re: Spring vs Blueprint

Posted by ch...@kiffer.ltd.uk.
Hi Richard,

> That was also my first gut feeling when starting with Spring. But since
> everybody uses it - and also seem to like it - I thought: OK, it's maybe
> just stupid me.

10 000 000 000 flies can't be wrong, right? Eat XML :-)



Re: Spring vs Blueprint

Posted by Achim Nierbeck <bc...@googlemail.com>.
Guess I've been a bit to fast on that mouse button :)



> In Eclipse IDE for example I got really used to browsing a classes type
>> hierarchy, quickly jump to it's implementation, it's references and such.
>> When using Spring I'm basically stuck to string searches. Or have I missed
>> some good Eclipse plugins? :-)
>>
>
but there is a Spring STS (or IDE) that helps with that.
And it also supports blueprint.
One more point for blueprint, cause all the other DI frameworks are missing
it.
It's good integration with JPA and JTA. So one might want to use blueprint
for that and mix it with DS for example.

regards, Achim

Re: Spring vs Blueprint

Posted by Achim Nierbeck <bc...@googlemail.com>.
2014-09-18 14:26 GMT+02:00 Richard Snowden <ri...@gmail.com>:

> Hi Benjamin,
>
>
>  Moreover, I feel that the need to write XML to define components  is a
>> hustle (think: refactoring and typing errors).
>>
>
> That was also my first gut feeling when starting with Spring. But since
> everybody uses it - and also seem to like it - I thought: OK, it's maybe
> just stupid me.
>
> In Eclipse IDE for example I got really used to browsing a classes type
> hierarchy, quickly jump to it's implementation, it's references and such.
> When using Spring I'm basically stuck to string searches. Or have I missed
> some good Eclipse plugins? :-)
>
> Regards,
> Richard
>
>


-- 

Apache Member
Apache Karaf <http://karaf.apache.org/> Committer & PMC
OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer &
Project Lead
blog <http://notizblog.nierbeck.de/>

Software Architect / Project Manager / Scrum Master

Re: Spring vs Blueprint

Posted by Richard Snowden <ri...@gmail.com>.
Hi Benjamin,


 Moreover, I feel that the need to write XML to define components  is a
> hustle (think: refactoring and typing errors).
>

That was also my first gut feeling when starting with Spring. But since
everybody uses it - and also seem to like it - I thought: OK, it's maybe
just stupid me.

In Eclipse IDE for example I got really used to browsing a classes type
hierarchy, quickly jump to it's implementation, it's references and such.
When using Spring I'm basically stuck to string searches. Or have I missed
some good Eclipse plugins? :-)

Regards,
Richard

RE: Spring vs Blueprint

Posted by Benjamin Debeerst <Be...@younicos.com>.
Hi Richard,

Since you mentioned being a OSGi/Karaf beginner, if you’re not bound to specific Blueprint or Spring features, I strongly advise you to have a look at the other component / DI frameworks that exist for OSGi, e.g. Declarative Services or iPOJO. From my perspective, while blueprint has strong integration features and is widely known, it does try to hide the dynamics behind the OSGi Service layer rather than leveraging it. Moreover, I feel that the need to write XML to define components  is a hustle (think: refactoring and typing errors). I try to avoid using blueprint at all. And last but not least: You can mix and match different component frameworks as they can perfectly coexist.

Regards,
Benjamin

From: Sobkowiak, Krzysztof [mailto:krzys.sobkowiak@gmail.com]
Sent: Donnerstag, 18. September 2014 11:07
To: user@karaf.apache.org
Subject: Re: Spring vs Blueprint

Hi

I think you will use Spring DM if you want to use Spring in your bundles - especially if you need to use any Spring schemes in your configuration.

Best regards
Krzysztof

On 18.09.2014 10:58, Mark Doyle wrote:
I think Spring DM is no longer active and I that blueprint (which is an OSGi standard) was inspired by DM.

That would explain why they are so similar. I'd use a blueprint implementation and I'm not sure why one would use DM any more.



On 18 September 2014 10:53, Richard Snowden <ri...@gmail.com>> wrote:
Hi all,

I just played around a little bit creating and consuming OSGi services. First with Blueprint and then with Spring. It seems there's no big difference between those two.

For me (as a beginner in OSGi / Karaf) Blueprint context files look smaller and cleaner, so I'd like to focus my efforts on Blueprint and forget about Spring. Is this a bad idea?
What is the main difference between Spring and Blueprint?

Regards,
Richard


--
Krzysztof Sobkowiak

JEE & OSS Architect | Technical Architect @ Capgemini | Committer @ ASF
Capgemini<http://www.pl.capgemini.com/> | Software Solutions Center<http://www.pl.capgemini-sdm.com/> | Wroclaw
e-mail: krzys.sobkowiak@gmail.com<ma...@gmail.com> | Twitter: @KSobkowiak
Calendar: http://goo.gl/yvsebC

Re: Spring vs Blueprint

Posted by "Sobkowiak, Krzysztof" <kr...@gmail.com>.
Hi

I think you will use Spring DM if you want to use Spring in your bundles
- especially if you need to use any Spring schemes in your configuration.

Best regards
Krzysztof


On 18.09.2014 10:58, Mark Doyle wrote:
> I think Spring DM is no longer active and I that blueprint (which is
> an OSGi standard) was inspired by DM.
>
> That would explain why they are so similar. I'd use a blueprint
> implementation and I'm not sure why one would use DM any more.
>
>
>
> On 18 September 2014 10:53, Richard Snowden
> <richard.t.snowden@gmail.com <ma...@gmail.com>> wrote:
>
>     Hi all,
>
>     I just played around a little bit creating and consuming OSGi
>     services. First with Blueprint and then with Spring. It seems
>     there's no big difference between those two.
>
>     For me (as a beginner in OSGi / Karaf) Blueprint context files
>     look smaller and cleaner, so I'd like to focus my efforts on
>     Blueprint and forget about Spring. Is this a bad idea?
>
>     What is the main difference between Spring and Blueprint?
>
>     Regards,
>     Richard
>
>

-- 
Krzysztof Sobkowiak

JEE & OSS Architect | Technical Architect @ Capgemini | Committer @ ASF
Capgemini <http://www.pl.capgemini.com/> | Software Solutions Center
<http://www.pl.capgemini-sdm.com/> | Wroclaw
e-mail: krzys.sobkowiak@gmail.com <ma...@gmail.com> |
Twitter: @KSobkowiak
Calendar: http://goo.gl/yvsebC

Re: Spring vs Blueprint

Posted by Mark Doyle <ma...@gmail.com>.
I think Spring DM is no longer active and I that blueprint (which is an
OSGi standard) was inspired by DM.

That would explain why they are so similar. I'd use a blueprint
implementation and I'm not sure why one would use DM any more.



On 18 September 2014 10:53, Richard Snowden <ri...@gmail.com>
wrote:

> Hi all,
>
> I just played around a little bit creating and consuming OSGi services.
> First with Blueprint and then with Spring. It seems there's no big
> difference between those two.
>
> For me (as a beginner in OSGi / Karaf) Blueprint context files look
> smaller and cleaner, so I'd like to focus my efforts on Blueprint and
> forget about Spring. Is this a bad idea?
>
> What is the main difference between Spring and Blueprint?
>
> Regards,
> Richard
>

Re: Spring vs Blueprint

Posted by Jean-Baptiste Onofré <jb...@nanthrax.net>.
Hi Richard,

Spring itself doesn't have OSGi support. You have to add Spring DM to 
get the OSGi features (osgix:service, osgix:reference, etc).

Actually, Blueprint comes from Spring DM, and Spring DM is not 
deprecated/dead (replaced by Blueprint Gemini).

In Karaf, we use Apache Aries Blueprint (Blueprint is the specification, 
we have two implementations: one in Apache Aries, one in Eclipse with 
Gemini).

Regards
JB

On 09/18/2014 10:53 AM, Richard Snowden wrote:
> Hi all,
>
> I just played around a little bit creating and consuming OSGi services.
> First with Blueprint and then with Spring. It seems there's no big
> difference between those two.
>
> For me (as a beginner in OSGi / Karaf) Blueprint context files look
> smaller and cleaner, so I'd like to focus my efforts on Blueprint and
> forget about Spring. Is this a bad idea?
>
> What is the main difference between Spring and Blueprint?
>
> Regards,
> Richard

-- 
Jean-Baptiste Onofré
jbonofre@apache.org
http://blog.nanthrax.net
Talend - http://www.talend.com

Re: Spring vs Blueprint

Posted by Tim Jones <ti...@mccarthy.co.nz>.
Thanks Johan, I was aware of
http://gnodet.blogspot.co.nz/2010/03/spring-dm-aries-blueprint-and-custom.html
but most of it went over my head. Do you have an updated link for
http://fusesource.com/camelone2011/camelone-2011-johan-jeff/?



--
View this message in context: http://karaf.922171.n3.nabble.com/Spring-vs-Blueprint-tp4035374p4035586.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Spring vs Blueprint

Posted by Johan Edstrom <se...@gmail.com>.
I don't think so, it doesn't have that much community though afaik. Johan Edstrom - via HopOn September 30, 2014 at 0:35 GMT, Tim Jones <ti...@mccarthy.co.nz> wrote:Does Gemini Blueprint suffer from the same issue?

Re: Spring vs Blueprint

Posted by Tim Jones <ti...@mccarthy.co.nz>.
Does Gemini Blueprint suffer from the same issue?



--
View this message in context: http://karaf.922171.n3.nabble.com/Spring-vs-Blueprint-tp4035374p4035587.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Spring vs Blueprint

Posted by Johan Edstrom <se...@gmail.com>.
Yep, essentially an EE class loader is applied to a matrix classloading system, that is why you can get really strange contextRefresh spins and things like class path: works across bundles although they really shouldn't. Johan Edstrom - via HopOn September 29, 2014 at 23:56 GMT, Tim Jones <ti...@mccarthy.co.nz> wrote:In other words are you saying that Spring DM will use the same class loaderfor all bundles as opposed to a different class loader for each bundle?

Re: Spring vs Blueprint

Posted by Tim Jones <ti...@mccarthy.co.nz>.
In other words are you saying that Spring DM will use the same class loader
for all bundles as opposed to a different class loader for each bundle?



--
View this message in context: http://karaf.922171.n3.nabble.com/Spring-vs-Blueprint-tp4035374p4035584.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Spring vs Blueprint

Posted by Johan Edstrom <se...@gmail.com>.
Bigtime spring does a global classloader vs blueprint building a recipe and actually starting bundles with their own classloaders, I did a talk on that at camel one 2011 Johan Edstrom - via HopOn September 29, 2014 at 21:49 GMT, Tim Jones <ti...@mccarthy.co.nz> wrote:Johan, is there any advantage in the way that Aries has solved class pathquite differently over Spring DM?

Re: Spring vs Blueprint

Posted by Tim Jones <ti...@mccarthy.co.nz>.
Johan, is there any advantage in the way that Aries has solved class path
quite differently over Spring DM? 



--
View this message in context: http://karaf.922171.n3.nabble.com/Spring-vs-Blueprint-tp4035374p4035581.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Spring vs Blueprint

Posted by Johan Edstrom <se...@gmail.com>.
What really is the biggest benefit is that Aries is actively developed and solved class path quite differently Johan Edstrom - via HopOn September 29, 2014 at 21:12 GMT, Tim Jones <ti...@mccarthy.co.nz> wrote:Steve, can you please expand a bit on what you mean by "without really being"container aware"" and  "leverage services or interact with the underlyingcontainer" as we use Spring DM but are not sure what we are missing out onby not switching to Blueprint. As far as I can see Spring DM can "leverageservices" with a similar end result from the user's point of view i.e.mechanics maybe different but with Spring DM a service can be provided andreferenced, can come and go etc.

Re: Spring vs Blueprint

Posted by Tim Jones <ti...@mccarthy.co.nz>.
Steve, can you please expand a bit on what you mean by "without really being
"container aware"" and  "leverage services or interact with the underlying
container" as we use Spring DM but are not sure what we are missing out on
by not switching to Blueprint. As far as I can see Spring DM can "leverage
services" with a similar end result from the user's point of view i.e.
mechanics maybe different but with Spring DM a service can be provided and
referenced, can come and go etc.



--
View this message in context: http://karaf.922171.n3.nabble.com/Spring-vs-Blueprint-tp4035374p4035578.html
Sent from the Karaf - User mailing list archive at Nabble.com.

Re: Spring vs Blueprint

Posted by Steve <de...@gmail.com>.
Richard,

If you're merely wanting to use Karaf as a container to run an
application without really being "container aware" than Spring DM is a
viable choice due to its familiarity for most developers.  I've seen
this used successfully for many Camel based applications that didn't
explicitly use any container-provided services but merely needed basic
life-cycle management.  That being said, if you want to leverage
services or interact with the underlying container than I strongly
recommend sticking with Blueprint.  It does a nice job of hiding the
dynamism of container-provided services (via proxies) and allows one
to wire them using dependency injection.  It is this "softening" of
the underlying service dynamism that makes Blueprint a great asset,
especially for new developers.

Additionally, it's worth noting that Blueprint is comparable to
Spring's dependency injection, not the entire Spring ecosystem which
encompasses far more than DI.  This may seem like a silly point to
make, but I have known people to get confused.


Best Regards,

Steve

On Thu, Sep 18, 2014 at 5:04 PM,  <ch...@kiffer.ltd.uk> wrote:
> I have used JPA with DS. It was OK so long as you didn't try to do
> anything too fancy - in my case it went adrift when I tried to embed an
> enum which was declared in another bundle, spent some time trying to debug
> this one but ran into a morass of proxy class loaders holding references
> to lists of BundleClassLoaders. To preserve my sanity, I changed my
> design.
>
> Good luck, Chris
>
>> Richard, these links don't explain the differences between Spring DM and
>> Blueprint but may help make up your mind, although note that since some of
>> the statements were made things may have changed. In summary it doesn't
>> appear clear (to me at least) where Spring-OSGI is heading, certainly some
>> concerns over support for Spring 4 and OSGI. Our application is based on
>> Spring DM (decision made a few years ago) however given the landscape as
>> it
>> is today I doubt whether we would have made the same decision.
>>
>>
>> -- Peter Kriens pro Declarative services -  DS is much better in working
>> with services than Blueprint/Spring DM since they tend to to want to
>> "hide"
>> the dynamicity
>> http://stackoverflow.com/questions/10008786/osgi-blueprint-vs-spring-dm
>>
>> -- Spring and OSGI
>> http://karaf.922171.n3.nabble.com/OSGI-and-Spring-td4033211.html#a4033254
>>
>> -- Spring and OSGI
>> http://karaf.922171.n3.nabble.com/Re-The-future-of-the-Spring-with-Fabric8-td4033455.html
>>
>> -- We should also make clear that Spring DM is dead. And that in general
>> Spring on OSGi is not a good idea
>> https://github.com/fabric8io/fabric8/issues/1634
>>
>> -- Spring stops creating OSGI bundles
>> http://stackoverflow.com/questions/21181154/where-can-i-find-spring-4-osgi-bundles
>> http://www.eclipse.org/forums/index.php/t/513222/
>>
>> -- Spring 4 + Gemini incompatibility
>> https://www.eclipse.org/forums/index.php/t/642416/
>>
>> -- I would be really careful with Gemini blueprint. Springsource seems to
>> have completely abondoned OSGi.
>> -- So I fear that Gemini blueprint will go the same way as spring dm which
>> is not maintained at all
>> http://stackoverflow.com/questions/20993870/most-suitable-osgi-platform/21013910#21013910
>>
>> -- I somehow doubt that gemini blueprint is still active. See
>> git.eclipse.org/c/gemini.blueprint/…
>> -- Not sure how active aries blueprint is.
>> http://stackoverflow.com/questions/22381205/osgi-declarative-services-and-spring
>>
>>
>>
>>
>> --
>> View this message in context:
>> http://karaf.922171.n3.nabble.com/Spring-vs-Blueprint-tp4035374p4035389.html
>> Sent from the Karaf - User mailing list archive at Nabble.com.
>>
>
>

Re: Spring vs Blueprint

Posted by ch...@kiffer.ltd.uk.
I have used JPA with DS. It was OK so long as you didn't try to do
anything too fancy - in my case it went adrift when I tried to embed an
enum which was declared in another bundle, spent some time trying to debug
this one but ran into a morass of proxy class loaders holding references
to lists of BundleClassLoaders. To preserve my sanity, I changed my
design.

Good luck, Chris

> Richard, these links don't explain the differences between Spring DM and
> Blueprint but may help make up your mind, although note that since some of
> the statements were made things may have changed. In summary it doesn't
> appear clear (to me at least) where Spring-OSGI is heading, certainly some
> concerns over support for Spring 4 and OSGI. Our application is based on
> Spring DM (decision made a few years ago) however given the landscape as
> it
> is today I doubt whether we would have made the same decision.
>
>
> -- Peter Kriens pro Declarative services -  DS is much better in working
> with services than Blueprint/Spring DM since they tend to to want to
> "hide"
> the dynamicity
> http://stackoverflow.com/questions/10008786/osgi-blueprint-vs-spring-dm
>
> -- Spring and OSGI
> http://karaf.922171.n3.nabble.com/OSGI-and-Spring-td4033211.html#a4033254
>
> -- Spring and OSGI
> http://karaf.922171.n3.nabble.com/Re-The-future-of-the-Spring-with-Fabric8-td4033455.html
>
> -- We should also make clear that Spring DM is dead. And that in general
> Spring on OSGi is not a good idea
> https://github.com/fabric8io/fabric8/issues/1634
>
> -- Spring stops creating OSGI bundles
> http://stackoverflow.com/questions/21181154/where-can-i-find-spring-4-osgi-bundles
> http://www.eclipse.org/forums/index.php/t/513222/
>
> -- Spring 4 + Gemini incompatibility
> https://www.eclipse.org/forums/index.php/t/642416/
>
> -- I would be really careful with Gemini blueprint. Springsource seems to
> have completely abondoned OSGi.
> -- So I fear that Gemini blueprint will go the same way as spring dm which
> is not maintained at all
> http://stackoverflow.com/questions/20993870/most-suitable-osgi-platform/21013910#21013910
>
> -- I somehow doubt that gemini blueprint is still active. See
> git.eclipse.org/c/gemini.blueprint/…
> -- Not sure how active aries blueprint is.
> http://stackoverflow.com/questions/22381205/osgi-declarative-services-and-spring
>
>
>
>
> --
> View this message in context:
> http://karaf.922171.n3.nabble.com/Spring-vs-Blueprint-tp4035374p4035389.html
> Sent from the Karaf - User mailing list archive at Nabble.com.
>



Re: Spring vs Blueprint

Posted by Tim Jones <ti...@mccarthy.co.nz>.
Richard, these links don't explain the differences between Spring DM and
Blueprint but may help make up your mind, although note that since some of
the statements were made things may have changed. In summary it doesn't
appear clear (to me at least) where Spring-OSGI is heading, certainly some
concerns over support for Spring 4 and OSGI. Our application is based on
Spring DM (decision made a few years ago) however given the landscape as it
is today I doubt whether we would have made the same decision.


-- Peter Kriens pro Declarative services -  DS is much better in working
with services than Blueprint/Spring DM since they tend to to want to "hide"
the dynamicity
http://stackoverflow.com/questions/10008786/osgi-blueprint-vs-spring-dm

-- Spring and OSGI
http://karaf.922171.n3.nabble.com/OSGI-and-Spring-td4033211.html#a4033254

-- Spring and OSGI
http://karaf.922171.n3.nabble.com/Re-The-future-of-the-Spring-with-Fabric8-td4033455.html

-- We should also make clear that Spring DM is dead. And that in general
Spring on OSGi is not a good idea
https://github.com/fabric8io/fabric8/issues/1634

-- Spring stops creating OSGI bundles
http://stackoverflow.com/questions/21181154/where-can-i-find-spring-4-osgi-bundles
http://www.eclipse.org/forums/index.php/t/513222/

-- Spring 4 + Gemini incompatibility
https://www.eclipse.org/forums/index.php/t/642416/

-- I would be really careful with Gemini blueprint. Springsource seems to
have completely abondoned OSGi. 
-- So I fear that Gemini blueprint will go the same way as spring dm which
is not maintained at all
http://stackoverflow.com/questions/20993870/most-suitable-osgi-platform/21013910#21013910

-- I somehow doubt that gemini blueprint is still active. See
git.eclipse.org/c/gemini.blueprint/… 
-- Not sure how active aries blueprint is. 
http://stackoverflow.com/questions/22381205/osgi-declarative-services-and-spring




--
View this message in context: http://karaf.922171.n3.nabble.com/Spring-vs-Blueprint-tp4035374p4035389.html
Sent from the Karaf - User mailing list archive at Nabble.com.