Spring

Project Hosting
NuGet Package NServiceBus.Spring (8-pre)
Target NServiceBus Version: 7.x
This page targets a pre-release version and is subject to change prior to the final release.

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.

Samples


Last modified