2014-11-02 86 views
0

我想在我的應用程序中使用Coda Hale的指標框架來計算方法。我配置了InstrumentedResourceMethodApplicationListener以將度量與Jersey 2集成,但是現在我想讓我的Spring注入的服務和存儲庫也定時。我知道有一個指標 - 彈簧整合,但看起來我最終會爲Spring和Jersey單獨使用MetricRegistry實例。有沒有人能夠爲Jersey 2和Spring注入bean配置一個註冊表?春季4 +澤西島2 +度量

回答

1

如果您配置Jersey to use Spring,您將可以使用metrics-spring來裝配彈簧豆。這將使你定義InstrumentedResourceMethodApplicationListener使用構造函數參數注入春天配置指標庫:

<bean id="metricsListener" class="com.codahale.metrics.jersey2.InstrumentedResourceMethodApplicationListener"> 
    <constructor-arg ref="metricsRegistry" /> 
</bean> 

您可能還需要configure the MetricsServlet