@Bean public MetricRepository counterRepository() { return new RedisMetricRepository(redisConnectionFactory); }
@Bean public CounterController counterController(MetricRepository metricRepository) { return new CounterController(metricRepository); }
@Bean public CounterService counterService(MetricRepository metricRepository) { return new DefaultCounterService(metricRepository); }
@Bean @ExportMetricWriter public MetricRepository metricRepository() { return new RedisMetricRepository(redisConnectionFactory); }
@Bean public MetricRepository metricRepository() { return new InMemoryMetricRepository(); }
@BeforeClass public static void setUpOnce() { repository = applicationContext.getBean(MetricRepository.class); }
@Bean @ConditionalOnMissingBean public MetricRepository metricRepository(RedisConnectionFactory redisConnectionFactory) { return new RedisMetricRepository(redisConnectionFactory); }
@Bean @ConditionalOnBean(MetricRepository.class) public CounterController counterController(MetricRepository metricRepository) { return new CounterController(metricRepository); }
@Autowired public MetricExporterService(@SuppressWarnings("SpringJavaAutowiringInspection") MetricRepository repository) { this.repository = repository; }
/** * Create a {@link CounterController} that delegates to the provided {@link MetricRepository}. * * @param metricRepository the {@link MetricRepository} used by this controller */ public CounterController(MetricRepository metricRepository) { Assert.notNull(metricRepository, "metricRepository must not be null"); this.metricRepository = metricRepository; }