use of org.springframework.context.annotation.Bean in project spring-boot by spring-projects.
the class SampleOpenTsdbExportApplication method openTsdbMetricWriter.
@Bean
@ConfigurationProperties("metrics.export")
@ExportMetricWriter
public GaugeWriter openTsdbMetricWriter() {
OpenTsdbGaugeWriter writer = new OpenTsdbGaugeWriter();
writer.setNamingStrategy(namingStrategy());
return writer;
}
use of org.springframework.context.annotation.Bean in project spring-boot by spring-projects.
the class WebConfig method viewResolver.
@Bean
public InternalResourceViewResolver viewResolver() {
InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
viewResolver.setPrefix("/WEB-INF/views/");
viewResolver.setSuffix(".jsp");
return viewResolver;
}
use of org.springframework.context.annotation.Bean in project spring-boot by spring-projects.
the class SampleIntegrationApplication method fileReader.
@Bean
public FileReadingMessageSource fileReader() {
FileReadingMessageSource reader = new FileReadingMessageSource();
reader.setDirectory(new File("target/input"));
return reader;
}
use of org.springframework.context.annotation.Bean in project spring-boot by spring-projects.
the class SampleJersey1Application method jersey.
@Bean
public FilterRegistrationBean<ServletContainer> jersey() {
FilterRegistrationBean<ServletContainer> bean = new FilterRegistrationBean<>();
bean.setFilter(new ServletContainer());
bean.addInitParameter("com.sun.jersey.config.property.packages", "com.sun.jersey;sample.jersey1");
return bean;
}
use of org.springframework.context.annotation.Bean in project spring-boot by spring-projects.
the class MetricExportAutoConfiguration method metricWritersMetricExporter.
@Bean
@ConditionalOnMissingBean(name = "metricWritersMetricExporter")
public SchedulingConfigurer metricWritersMetricExporter(MetricExportProperties properties) {
Map<String, GaugeWriter> writers = new HashMap<>();
MetricReader reader = this.endpointReader;
if (reader == null && !CollectionUtils.isEmpty(this.readers)) {
reader = new CompositeMetricReader(this.readers.toArray(new MetricReader[this.readers.size()]));
}
if (reader == null && CollectionUtils.isEmpty(this.exporters)) {
return new NoOpSchedulingConfigurer();
}
MetricExporters exporters = new MetricExporters(properties);
if (reader != null) {
if (!CollectionUtils.isEmpty(this.writers)) {
writers.putAll(this.writers);
}
exporters.setReader(reader);
exporters.setWriters(writers);
}
exporters.setExporters(this.exporters == null ? Collections.<String, Exporter>emptyMap() : this.exporters);
return exporters;
}
Aggregations