Spring

Project Hosting
NuGet NServiceBus.Spring (7.x)
Target NServiceBus Version: 6.x

NServiceBus can be configured to use Spring as a dependency injection container.

Default Usage

endpointConfiguration.UseContainer<SpringBuilder>();

Existing Container Instance

var applicationContext = new GenericApplicationContext();
applicationContext.ObjectFactory
    .RegisterSingleton("MyService", new MyService());
endpointConfiguration.UseContainer<SpringBuilder>(
    customizations: customizations =>
    {
        customizations.ExistingApplicationContext(applicationContext);
    });

DependencyLifecycle Mapping

The way that the NServiceBus.Spring adapter is implemented means that the dependency lifecycle's of NServiceBus do not map directly to Spring Object Scopes. Almost all of the lifecycles have been implemented using a custom type regsitrations on top of a Generic Application Context.


Last modified