Skip to content

Instantly share code, notes, and snippets.

@mykidong
Created May 24, 2018 13:53
Show Gist options
  • Save mykidong/3af2b6e35c51fd5988259dfa3c58a343 to your computer and use it in GitHub Desktop.
Save mykidong/3af2b6e35c51fd5988259dfa3c58a343 to your computer and use it in GitHub Desktop.
import com.codahale.metrics.MetricRegistry;
import org.springframework.beans.factory.FactoryBean;
import org.springframework.beans.factory.InitializingBean;
public class MetricRegistryFactory implements InitializingBean, FactoryBean<MetricRegistry> {
private MetricRegistry metricRegistry;
@Override
public void afterPropertiesSet() throws Exception {
this.metricRegistry = new MetricRegistry();
}
@Override
public MetricRegistry getObject() throws Exception {
return this.metricRegistry;
}
@Override
public Class<?> getObjectType() {
return this.metricRegistry.getClass();
}
@Override
public boolean isSingleton() {
return true;
}
}
@mykidong
Copy link
Author

.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment