ryantenney/metrics-spring — pull request #27 by yanys (2013-06-19 14:33:43+00:00)
Title: Use SmartLifecycle instead of Lifecycle for Spring beans lifecycle management

Hello, Ryan.
I see you are using Spring `Lifecycle` interface to listen for container start/stop events. In some cases (e.g on context refresh) `Lifecycle#start` method will not be called by `DefaultLifecycleProcessor`, so `SmartLifecycle` seems more appropriate.

Please see `org.springframework.context.support.DefaultLifecycleProcessor#doStart`:

```java
if (!autoStartupOnly || (bean instanceof SmartLifecycle && ((SmartLifecycle) bean).isAutoStartup())) {
```

We can overcome this by implementing `SmartLifecycle` instead of `Lifecycle` with `isAutoStartup` method returning `true`.