2

I'm starting an OSGI Spring DM based Swing application. The app should start and show up when the bundle is loaded. I know that this can be achieved with an activator class configured by manifest.mf file.

My problem: How can I inject bean references/services to this activator class using Spring as the activator is not configured in Spring context?

Should I not use the OSGI activator? How can Spring startup the application on bundle start?

Any kind of remarks are apreciated as I'm new to OSGI with Spring DM.

Cheers, Sven

skaffman
  • 398,947
  • 96
  • 818
  • 769
Sven
  • 166
  • 4

1 Answers1

1

You do not need an activator. Spring-DM has an "extender" bundle that automatically scans your bundle for two things:

  • One or more .xml files in the META-INF/spring folder of your bundle;
  • A Spring-Context header in your MANIFEST.MF, which points to one or more .xml files that may be anywhere inside your bundle.

If it finds either of these (and if your bundle is in the ACTIVE state) then it will load the Spring application context using the declared XML files.

Neil Bartlett
  • 23,743
  • 4
  • 44
  • 77
  • 1
    Thanks Neil. I probably didn't make my problem clear. I have an main Window/JFrame which will be created within the activator. To put some spring beans/services into this frame I somehow need to know when the spring context is initialized which will be somewhen AFTER the startup of the bundle. how do I get notified about this? – Sven Mar 06 '11 at 17:54