Sven
Sven

Reputation: 166

Swing App with Spring DM startup problem

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

Upvotes: 2

Views: 339

Answers (1)

Neil Bartlett
Neil Bartlett

Reputation: 23958

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.

Upvotes: 1

Related Questions