PDA

View Full Version : Spring http invoker: retrieving the application context...?



gvl@foundation.be
Jun 10th, 2005, 04:36 AM
Hello all,

we have a gui client application talking to services configured with spring http invoker. The dependencies of these services are configured in the spring application context.

How to retrieve a reference to the application context used by spring http invoker in classes that are not configured by spring. e.g. we need a reference to the datasource defined in the application context in a workflow utility class. This workflow utility class cannot be configured by spring.

How to retrieve a reference :?:

kind regards,
Geert Van Landeghem

Rod Johnson
Jun 21st, 2005, 12:59 AM
Can you modify the workflow utility class at all? If so, why can't it be configured by Spring? I'm not sure I fully understand your issue, so an illustration may help.

As a last resort, you could make one of your classes ApplicationContextAware, and expose a static getApplicationContext() method, but of course this is not really in the spirit of Dependency Injection.