Move to constructor injection in simple configuration classes

This commit updates "simple" configuration classes to use constructor
injection. Simple means that there are no optional dependencies
(@Autowired(required=false) is not used), and none of the dependencies
use generics.

Configuration classes that are not simple will be updated in a second
pass once https://jira.spring.io/browse/SPR-14015 has been fixed.

See gh-5306
This commit is contained in:
Andy Wilkinson
2016-03-04 10:49:17 +00:00
parent 398aed7fdb
commit 5009933788
74 changed files with 525 additions and 321 deletions

View File

@@ -16,7 +16,6 @@
package sample.metrics.redis;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.actuate.endpoint.MetricReaderPublicMetrics;
import org.springframework.boot.actuate.endpoint.PublicMetrics;
import org.springframework.boot.actuate.metrics.aggregate.AggregateMetricReader;
@@ -30,11 +29,15 @@ import org.springframework.data.redis.connection.RedisConnectionFactory;
@Configuration
public class AggregateMetricsConfiguration {
@Autowired
private MetricExportProperties export;
private final MetricExportProperties export;
@Autowired
private RedisConnectionFactory connectionFactory;
private final RedisConnectionFactory connectionFactory;
public AggregateMetricsConfiguration(MetricExportProperties export,
RedisConnectionFactory connectionFactory) {
this.export = export;
this.connectionFactory = connectionFactory;
}
@Bean
public PublicMetrics metricsAggregate() {