Search in sources :

Example 56 with Bean

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;
}
Also used : OpenTsdbGaugeWriter(org.springframework.boot.actuate.metrics.opentsdb.OpenTsdbGaugeWriter) ExportMetricWriter(org.springframework.boot.actuate.autoconfigure.ExportMetricWriter) EnableConfigurationProperties(org.springframework.boot.context.properties.EnableConfigurationProperties) ConfigurationProperties(org.springframework.boot.context.properties.ConfigurationProperties) Bean(org.springframework.context.annotation.Bean)

Example 57 with Bean

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;
}
Also used : InternalResourceViewResolver(org.springframework.web.servlet.view.InternalResourceViewResolver) Bean(org.springframework.context.annotation.Bean)

Example 58 with Bean

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;
}
Also used : File(java.io.File) FileReadingMessageSource(org.springframework.integration.file.FileReadingMessageSource) Bean(org.springframework.context.annotation.Bean)

Example 59 with Bean

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;
}
Also used : ServletContainer(com.sun.jersey.spi.container.servlet.ServletContainer) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) FilterRegistrationBean(org.springframework.boot.web.servlet.FilterRegistrationBean) Bean(org.springframework.context.annotation.Bean)

Example 60 with 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;
}
Also used : CompositeMetricReader(org.springframework.boot.actuate.metrics.reader.CompositeMetricReader) HashMap(java.util.HashMap) GaugeWriter(org.springframework.boot.actuate.metrics.writer.GaugeWriter) CompositeMetricReader(org.springframework.boot.actuate.metrics.reader.CompositeMetricReader) MetricReader(org.springframework.boot.actuate.metrics.reader.MetricReader) MetricsEndpointMetricReader(org.springframework.boot.actuate.endpoint.MetricsEndpointMetricReader) Exporter(org.springframework.boot.actuate.metrics.export.Exporter) MetricExporters(org.springframework.boot.actuate.metrics.export.MetricExporters) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) ConditionalOnMissingBean(org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean) Bean(org.springframework.context.annotation.Bean)

Aggregations

Bean (org.springframework.context.annotation.Bean)4059 ConditionalOnMissingBean (org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean)1090 RefreshScope (org.springframework.cloud.context.config.annotation.RefreshScope)444 ConditionalOnBean (org.springframework.boot.autoconfigure.condition.ConditionalOnBean)393 ConditionalOnClass (org.springframework.boot.autoconfigure.condition.ConditionalOnClass)309 lombok.val (lombok.val)294 HashMap (java.util.HashMap)285 Lazy (org.springframework.context.annotation.Lazy)257 LocalContainerEntityManagerFactoryBean (org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean)194 FilterRegistrationBean (org.springframework.boot.web.servlet.FilterRegistrationBean)158 Map (java.util.Map)152 ServletRegistrationBean (org.springframework.boot.web.servlet.ServletRegistrationBean)112 Properties (java.util.Properties)100 Autowired (org.springframework.beans.factory.annotation.Autowired)93 ArrayList (java.util.ArrayList)85 Primary (org.springframework.context.annotation.Primary)84 Qualifier (org.springframework.beans.factory.annotation.Qualifier)75 CamelContextAware (org.apache.camel.CamelContextAware)69 ThreadPoolTaskExecutor (org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor)69 JpaTransactionManager (org.springframework.orm.jpa.JpaTransactionManager)61