Join GitHub today
Do not modify an application bundles autostart setting when stopping a bundle when the spring application context fails #296
When using NEBA with Spring, NEBA registers a ContextShutdownHandler that will stop a bundle who's Spring Application Handler failed to start. This is rather useful as otherwise the bundle remains Active and it becomes hard to spot that a bundle exhibited a failure of part of its infrastructure.
The current implementation stops the bundle by invoking Bundle#stop(). This however persists the bundle's autostart setting. That is, the framework will not automatically try to re-start the bundle when the framework restarts.
This is an issue in case there is nothing to resolve, e.g. when the Application Context Failure was temporary. For instance, it may be that a framework restart is issued while an application context is in the process of starting, thus leading to a context start failure. Subsequently, the app bundle has to be re-started manually.
Here, the bundle state must not be persisted, i.e. Bundle#stop must be invoked with a suitable argument.