This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

OSGi and Spring modules

 
Manassés Souza
Greenhorn
Posts: 11
Android Java Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Craig and ranchers!

Wich Spring core functionality (DI, AOP, ...) better suite OSGi ? and what´s the relantionship with other Spring projects (Web flow, Security, etc.) ?

Thanks!
 
Craig Walls
author
Ranch Hand
Posts: 363
8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Manassés Souza wrote:Wich Spring core functionality (DI, AOP, ...) better suite OSGi ? and what´s the relantionship with other Spring projects (Web flow, Security, etc.)


That's a tough one to answer. Certainly DI and OSGi go together very well, as that's what Spring-DM is all about: wiring OSGi services and wiring the beans that make up those services. AOP is a bit tougher, because (due to OSGi's unique way of dealing with the classpath), AOP's reach is a bit constrained in OSGi.

As for the rest of the Spring portfolio...I'm not sure, but I suspect most or all of it can fit into OSGi somehow. It just kinda depends on what you want to do.

In my opinion, one such mix of Spring in OSGi that looks appealing is a mixture of Spring-DM, Spring Security, Spring Integration, and Spring-WS. I've not spent any time exploring this mix, but I've pondered it quite some bit on my drive to work and it seems like a powerful mix of Spring related technologies within OSGi.
 
Hong Anderson
Ranch Hand
Posts: 1936
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Craig Walls wrote:
AOP is a bit tougher, because (due to OSGi's unique way of dealing with the classpath), AOP's reach is a bit constrained in OSGi.

Could you please to explain more on this? How could using OGSi make it difficult to use Spring AOP?
 
Craig Walls
author
Ranch Hand
Posts: 363
8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kengkaj Sathianpantarit wrote:
Craig Walls wrote:
AOP is a bit tougher, because (due to OSGi's unique way of dealing with the classpath), AOP's reach is a bit constrained in OSGi.

Could you please to explain more on this? How could using OGSi make it difficult to use Spring AOP?


Well, the gist of it has to do with OSGi's way of constraining the classloader. Each bundle gets its own classloader and that bundle can only see its own contents plus the contents of the packages that it has imported. That means that a bundle with an aspect in it can only advise those things it sees and not necessarily everything in the OSGi runtime. (As opposed to non-OSGi where the classpath is one big dumping ground for classes and resources and an aspect can advise pretty much anything its pointcut specifies.)
 
Hong Anderson
Ranch Hand
Posts: 1936
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I see, but I think it might be a good thing to advise only things a bundle see, what do you think?

I don't like AOP much, and I would not advise junior developers to use AOP.
I'm not quite comfortable for the fact that I might accidentally advise something I don't want or I don't even know about.
Or when I'm refactoring a class, maybe this class is being advised from an unknown aspect, and refactoring it might break some functionality.
 
Craig Walls
author
Ranch Hand
Posts: 363
8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Kengkaj Sathianpantarit wrote:I see, but I think it might be a good thing to advise only things a bundle see, what do you think?


Maybe, but I think that there's a certain amount of value in creating a bundle that provides an aspect that can be used across all other bundles. I can totally understand the concerns you presented, but I still kinda like the idea and can see it being useful (even if dangerous in the wrong hands).
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic