mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-08-29 03:06:45 +08:00
Update auto-configuration @Bean methods to return most specific type
Closes gh-2536 Closes gh-2403
This commit is contained in:
parent
a9737c016c
commit
bedf2edffa
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -60,7 +60,7 @@ public class AuditAutoConfiguration {
|
||||
@ConditionalOnMissingBean(AuditEventRepository.class)
|
||||
protected static class AuditEventRepositoryConfiguration {
|
||||
@Bean
|
||||
public AuditEventRepository auditEventRepository() throws Exception {
|
||||
public InMemoryAuditEventRepository auditEventRepository() throws Exception {
|
||||
return new InMemoryAuditEventRepository();
|
||||
}
|
||||
}
|
||||
|
@ -124,28 +124,28 @@ public class CrshAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "shell", name = "auth", havingValue = "jaas")
|
||||
@ConditionalOnMissingBean({ CrshShellAuthenticationProperties.class })
|
||||
public CrshShellAuthenticationProperties jaasAuthenticationProperties() {
|
||||
@ConditionalOnMissingBean(CrshShellAuthenticationProperties.class)
|
||||
public JaasAuthenticationProperties jaasAuthenticationProperties() {
|
||||
return new JaasAuthenticationProperties();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "shell", name = "auth", havingValue = "key")
|
||||
@ConditionalOnMissingBean({ CrshShellAuthenticationProperties.class })
|
||||
public CrshShellAuthenticationProperties keyAuthenticationProperties() {
|
||||
@ConditionalOnMissingBean(CrshShellAuthenticationProperties.class)
|
||||
public KeyAuthenticationProperties keyAuthenticationProperties() {
|
||||
return new KeyAuthenticationProperties();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "shell", name = "auth", havingValue = "simple", matchIfMissing = true)
|
||||
@ConditionalOnMissingBean({ CrshShellAuthenticationProperties.class })
|
||||
public CrshShellAuthenticationProperties simpleAuthenticationProperties() {
|
||||
@ConditionalOnMissingBean(CrshShellAuthenticationProperties.class)
|
||||
public SimpleAuthenticationProperties simpleAuthenticationProperties() {
|
||||
return new SimpleAuthenticationProperties();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean({ PluginLifeCycle.class })
|
||||
public PluginLifeCycle shellBootstrap() {
|
||||
@ConditionalOnMissingBean(PluginLifeCycle.class)
|
||||
public CrshBootstrapBean shellBootstrap() {
|
||||
CrshBootstrapBean bootstrapBean = new CrshBootstrapBean();
|
||||
bootstrapBean.setConfig(this.properties.asCrshShellConfig());
|
||||
return bootstrapBean;
|
||||
@ -156,7 +156,7 @@ public class CrshAutoConfiguration {
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnProperty(prefix = "shell", name = "auth", havingValue = "spring", matchIfMissing = true)
|
||||
@ConditionalOnBean({ AuthenticationManager.class })
|
||||
@ConditionalOnBean(AuthenticationManager.class)
|
||||
@AutoConfigureAfter(CrshAutoConfiguration.class)
|
||||
public static class AuthenticationManagerAdapterAutoConfiguration {
|
||||
|
||||
@ -164,13 +164,13 @@ public class CrshAutoConfiguration {
|
||||
private ManagementServerProperties management;
|
||||
|
||||
@Bean
|
||||
public CRaSHPlugin<?> shellAuthenticationManager() {
|
||||
public AuthenticationManagerAdapter shellAuthenticationManager() {
|
||||
return new AuthenticationManagerAdapter();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean({ CrshShellAuthenticationProperties.class })
|
||||
public CrshShellAuthenticationProperties springAuthenticationProperties() {
|
||||
@ConditionalOnMissingBean(CrshShellAuthenticationProperties.class)
|
||||
public SpringAuthenticationProperties springAuthenticationProperties() {
|
||||
// In case no shell.auth property is provided fall back to Spring Security
|
||||
// based authentication and get role to access shell from
|
||||
// ManagementServerProperties.
|
||||
|
@ -18,7 +18,6 @@ package org.springframework.boot.actuate.autoconfigure;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.FilterChain;
|
||||
import javax.servlet.Servlet;
|
||||
import javax.servlet.ServletException;
|
||||
@ -91,11 +90,12 @@ import org.springframework.web.servlet.DispatcherServlet;
|
||||
@ConditionalOnClass({ Servlet.class, DispatcherServlet.class })
|
||||
@ConditionalOnWebApplication
|
||||
@AutoConfigureAfter({ PropertyPlaceholderAutoConfiguration.class,
|
||||
EmbeddedServletContainerAutoConfiguration.class, WebMvcAutoConfiguration.class,
|
||||
ManagementServerPropertiesAutoConfiguration.class, RepositoryRestMvcAutoConfiguration.class,
|
||||
HypermediaAutoConfiguration.class, HttpMessageConvertersAutoConfiguration.class })
|
||||
EmbeddedServletContainerAutoConfiguration.class, WebMvcAutoConfiguration.class,
|
||||
ManagementServerPropertiesAutoConfiguration.class,
|
||||
RepositoryRestMvcAutoConfiguration.class, HypermediaAutoConfiguration.class,
|
||||
HttpMessageConvertersAutoConfiguration.class })
|
||||
public class EndpointWebMvcAutoConfiguration implements ApplicationContextAware,
|
||||
BeanFactoryAware, SmartInitializingSingleton {
|
||||
BeanFactoryAware, SmartInitializingSingleton {
|
||||
|
||||
private static final Log logger = LogFactory
|
||||
.getLog(EndpointWebMvcAutoConfiguration.class);
|
||||
@ -130,7 +130,7 @@ BeanFactoryAware, SmartInitializingSingleton {
|
||||
if (managementPort == ManagementServerPort.DIFFERENT
|
||||
&& this.applicationContext instanceof EmbeddedWebApplicationContext
|
||||
&& ((EmbeddedWebApplicationContext) this.applicationContext)
|
||||
.getEmbeddedServletContainer() != null) {
|
||||
.getEmbeddedServletContainer() != null) {
|
||||
createChildManagementContext();
|
||||
}
|
||||
if (managementPort == ManagementServerPort.SAME
|
||||
@ -150,7 +150,7 @@ BeanFactoryAware, SmartInitializingSingleton {
|
||||
EmbeddedServletContainerAutoConfiguration.class,
|
||||
DispatcherServletAutoConfiguration.class);
|
||||
CloseEventPropagationListener
|
||||
.addIfPossible(this.applicationContext, childContext);
|
||||
.addIfPossible(this.applicationContext, childContext);
|
||||
try {
|
||||
childContext.refresh();
|
||||
managementContextResolver().setApplicationContext(childContext);
|
||||
@ -193,7 +193,8 @@ BeanFactoryAware, SmartInitializingSingleton {
|
||||
protected static class ApplicationContextFilterConfiguration {
|
||||
|
||||
@Bean
|
||||
public Filter applicationContextIdFilter(ApplicationContext context) {
|
||||
public ApplicationContextHeaderFilter applicationContextIdFilter(
|
||||
ApplicationContext context) {
|
||||
return new ApplicationContextHeaderFilter(context);
|
||||
}
|
||||
|
||||
@ -222,7 +223,7 @@ BeanFactoryAware, SmartInitializingSingleton {
|
||||
@Override
|
||||
protected void doFilterInternal(HttpServletRequest request,
|
||||
HttpServletResponse response, FilterChain filterChain)
|
||||
throws ServletException, IOException {
|
||||
throws ServletException, IOException {
|
||||
if (this.properties == null) {
|
||||
this.properties = this.applicationContext
|
||||
.getBean(ManagementServerProperties.class);
|
||||
@ -241,7 +242,7 @@ BeanFactoryAware, SmartInitializingSingleton {
|
||||
* parent to a child.
|
||||
*/
|
||||
private static class CloseEventPropagationListener implements
|
||||
ApplicationListener<ContextClosedEvent> {
|
||||
ApplicationListener<ContextClosedEvent> {
|
||||
|
||||
private final ApplicationContext parentContext;
|
||||
|
||||
@ -276,7 +277,7 @@ BeanFactoryAware, SmartInitializingSingleton {
|
||||
}
|
||||
|
||||
private static class OnManagementMvcCondition extends SpringBootCondition implements
|
||||
ConfigurationCondition {
|
||||
ConfigurationCondition {
|
||||
|
||||
@Override
|
||||
public ConfigurationPhase getConfigurationPhase() {
|
||||
@ -325,7 +326,7 @@ BeanFactoryAware, SmartInitializingSingleton {
|
||||
return ((managementPort == null)
|
||||
|| (serverPort == null && managementPort.equals(8080))
|
||||
|| (managementPort != 0 && managementPort.equals(serverPort)) ? SAME
|
||||
: DIFFERENT);
|
||||
: DIFFERENT);
|
||||
}
|
||||
|
||||
private static Integer getPortProperty(Environment environment, String prefix) {
|
||||
|
@ -16,8 +16,6 @@
|
||||
|
||||
package org.springframework.boot.actuate.autoconfigure;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Type;
|
||||
import java.util.Map;
|
||||
@ -84,6 +82,8 @@ import com.fasterxml.jackson.annotation.JsonUnwrapped;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.dataformat.xml.annotation.JacksonXmlRootElement;
|
||||
|
||||
import static org.springframework.hateoas.mvc.ControllerLinkBuilder.linkTo;
|
||||
|
||||
/**
|
||||
* Configuration for hypermedia in HTTP endpoints.
|
||||
*
|
||||
@ -136,7 +136,7 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration {
|
||||
@Configuration("EndpointHypermediaAutoConfiguration.MissingResourceCondition")
|
||||
@ConditionalOnResource(resources = "classpath:/META-INF/spring-data-rest/hal-browser/index.html")
|
||||
protected static class MissingSpringDataRestResourceCondition extends
|
||||
SpringBootCondition {
|
||||
SpringBootCondition {
|
||||
|
||||
@Override
|
||||
public ConditionOutcome getMatchOutcome(ConditionContext context,
|
||||
@ -175,7 +175,7 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration {
|
||||
}
|
||||
|
||||
private static class NotSpringDataRestHomePageCondition extends
|
||||
SpringBootCondition {
|
||||
SpringBootCondition {
|
||||
|
||||
@Override
|
||||
public ConditionOutcome getMatchOutcome(ConditionContext context,
|
||||
@ -302,7 +302,7 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration {
|
||||
public Object beforeBodyWrite(Object body, MethodParameter returnType,
|
||||
MediaType selectedContentType,
|
||||
Class<? extends HttpMessageConverter<?>> selectedConverterType,
|
||||
ServerHttpRequest request, ServerHttpResponse response) {
|
||||
ServerHttpRequest request, ServerHttpResponse response) {
|
||||
if (request instanceof ServletServerHttpRequest) {
|
||||
beforeBodyWrite(body, (ServletServerHttpRequest) request);
|
||||
}
|
||||
@ -383,7 +383,7 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration {
|
||||
public Object beforeBodyWrite(Object body, MethodParameter returnType,
|
||||
MediaType selectedContentType,
|
||||
Class<? extends HttpMessageConverter<?>> selectedConverterType,
|
||||
ServerHttpRequest request, ServerHttpResponse response) {
|
||||
ServerHttpRequest request, ServerHttpResponse response) {
|
||||
if (request instanceof ServletServerHttpRequest) {
|
||||
return beforeBodyWrite(body, returnType, selectedContentType,
|
||||
selectedConverterType, (ServletServerHttpRequest) request,
|
||||
@ -395,7 +395,7 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration {
|
||||
private Object beforeBodyWrite(Object body, MethodParameter returnType,
|
||||
MediaType selectedContentType,
|
||||
Class<? extends HttpMessageConverter<?>> selectedConverterType,
|
||||
ServletServerHttpRequest request, ServerHttpResponse response) {
|
||||
ServletServerHttpRequest request, ServerHttpResponse response) {
|
||||
if (body == null || body instanceof Resource) {
|
||||
// Assume it already was handled or it already has its links
|
||||
return body;
|
||||
@ -420,7 +420,7 @@ public class EndpointWebMvcHypermediaManagementContextConfiguration {
|
||||
@SuppressWarnings("unchecked")
|
||||
private HttpMessageConverter<Object> findConverter(
|
||||
Class<? extends HttpMessageConverter<?>> selectedConverterType,
|
||||
MediaType mediaType) {
|
||||
MediaType mediaType) {
|
||||
if (this.converterCache.containsKey(mediaType)) {
|
||||
return (HttpMessageConverter<Object>) this.converterCache
|
||||
.get(mediaType);
|
||||
|
@ -92,8 +92,8 @@ public class HealthIndicatorAutoConfiguration {
|
||||
private HealthIndicatorAutoConfigurationProperties configurationProperties = new HealthIndicatorAutoConfigurationProperties();
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public HealthAggregator healthAggregator() {
|
||||
@ConditionalOnMissingBean(HealthAggregator.class)
|
||||
public OrderedHealthAggregator healthAggregator() {
|
||||
OrderedHealthAggregator healthAggregator = new OrderedHealthAggregator();
|
||||
if (this.configurationProperties.getOrder() != null) {
|
||||
healthAggregator.setStatusOrder(this.configurationProperties.getOrder());
|
||||
@ -103,7 +103,7 @@ public class HealthIndicatorAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(HealthIndicator.class)
|
||||
public HealthIndicator applicationHealthIndicator() {
|
||||
public ApplicationHealthIndicator applicationHealthIndicator() {
|
||||
return new ApplicationHealthIndicator();
|
||||
}
|
||||
|
||||
@ -264,7 +264,7 @@ public class HealthIndicatorAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(name = "diskSpaceHealthIndicator")
|
||||
public HealthIndicator diskSpaceHealthIndicator(
|
||||
public DiskSpaceHealthIndicator diskSpaceHealthIndicator(
|
||||
DiskSpaceHealthIndicatorProperties properties) {
|
||||
return new DiskSpaceHealthIndicator(properties);
|
||||
}
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
package org.springframework.boot.actuate.autoconfigure;
|
||||
|
||||
import javax.servlet.Filter;
|
||||
import javax.servlet.Servlet;
|
||||
import javax.servlet.ServletRegistration;
|
||||
|
||||
@ -56,7 +55,7 @@ public class MetricFilterAutoConfiguration {
|
||||
private GaugeService gaugeService;
|
||||
|
||||
@Bean
|
||||
public Filter metricFilter() {
|
||||
public MetricsFilter metricFilter() {
|
||||
return new MetricsFilter(this.counterService, this.gaugeService);
|
||||
}
|
||||
|
||||
|
@ -91,14 +91,14 @@ public class MetricRepositoryAutoConfiguration {
|
||||
private MetricWriter writer;
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public CounterService counterService() {
|
||||
@ConditionalOnMissingBean(CounterService.class)
|
||||
public DefaultCounterService counterService() {
|
||||
return new DefaultCounterService(this.writer);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public GaugeService gaugeService() {
|
||||
@ConditionalOnMissingBean(GaugeService.class)
|
||||
public DefaultGaugeService gaugeService() {
|
||||
return new DefaultGaugeService(this.writer);
|
||||
}
|
||||
|
||||
@ -130,14 +130,14 @@ public class MetricRepositoryAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public CounterService counterService(CounterBuffers writer) {
|
||||
@ConditionalOnMissingBean(CounterService.class)
|
||||
public BufferCounterService counterService(CounterBuffers writer) {
|
||||
return new BufferCounterService(writer);
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public GaugeService gaugeService(GaugeBuffers writer) {
|
||||
@ConditionalOnMissingBean(GaugeService.class)
|
||||
public BufferGaugeService gaugeService(GaugeBuffers writer) {
|
||||
return new BufferGaugeService(writer);
|
||||
}
|
||||
}
|
||||
|
@ -17,7 +17,6 @@
|
||||
package org.springframework.boot.actuate.autoconfigure;
|
||||
|
||||
import org.springframework.boot.actuate.endpoint.MetricReaderPublicMetrics;
|
||||
import org.springframework.boot.actuate.endpoint.PublicMetrics;
|
||||
import org.springframework.boot.actuate.metrics.CounterService;
|
||||
import org.springframework.boot.actuate.metrics.GaugeService;
|
||||
import org.springframework.boot.actuate.metrics.dropwizard.DropwizardMetricServices;
|
||||
@ -56,7 +55,7 @@ public class MetricsDropwizardAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PublicMetrics dropwizardPublicMetrics(MetricRegistry metricRegistry) {
|
||||
public MetricReaderPublicMetrics dropwizardPublicMetrics(MetricRegistry metricRegistry) {
|
||||
MetricRegistryMetricReader reader = new MetricRegistryMetricReader(metricRegistry);
|
||||
return new MetricReaderPublicMetrics(reader);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -31,9 +31,9 @@ import org.springframework.context.annotation.Configuration;
|
||||
@Configuration
|
||||
public class TraceRepositoryAutoConfiguration {
|
||||
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnMissingBean(TraceRepository.class)
|
||||
@Bean
|
||||
public TraceRepository traceRepository() {
|
||||
public InMemoryTraceRepository traceRepository() {
|
||||
return new InMemoryTraceRepository();
|
||||
}
|
||||
|
||||
|
@ -106,7 +106,7 @@ public class RabbitAutoConfiguration {
|
||||
protected static class RabbitConnectionFactoryCreator {
|
||||
|
||||
@Bean
|
||||
public ConnectionFactory rabbitConnectionFactory(RabbitProperties config)
|
||||
public CachingConnectionFactory rabbitConnectionFactory(RabbitProperties config)
|
||||
throws Exception {
|
||||
RabbitConnectionFactoryBean factory = new RabbitConnectionFactoryBean();
|
||||
if (config.getHost() != null) {
|
||||
|
@ -29,7 +29,6 @@ import org.springframework.batch.core.launch.JobOperator;
|
||||
import org.springframework.batch.core.launch.support.SimpleJobOperator;
|
||||
import org.springframework.batch.core.repository.JobRepository;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ExitCodeGenerator;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
@ -93,7 +92,7 @@ public class BatchAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public ExitCodeGenerator jobExecutionExitCodeGenerator() {
|
||||
public JobExecutionExitCodeGenerator jobExecutionExitCodeGenerator() {
|
||||
return new JobExecutionExitCodeGenerator();
|
||||
}
|
||||
|
||||
@ -112,9 +111,10 @@ public class BatchAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public JobOperator jobOperator(JobExplorer jobExplorer, JobLauncher jobLauncher,
|
||||
ListableJobLocator jobRegistry, JobRepository jobRepository) throws Exception {
|
||||
@ConditionalOnMissingBean(JobOperator.class)
|
||||
public SimpleJobOperator jobOperator(JobExplorer jobExplorer,
|
||||
JobLauncher jobLauncher, ListableJobLocator jobRegistry,
|
||||
JobRepository jobRepository) throws Exception {
|
||||
SimpleJobOperator factory = new SimpleJobOperator();
|
||||
factory.setJobExplorer(jobExplorer);
|
||||
factory.setJobLauncher(jobLauncher);
|
||||
@ -139,7 +139,7 @@ public class BatchAutoConfiguration {
|
||||
// Boot in the JPA auto configuration.
|
||||
@Bean
|
||||
@ConditionalOnBean(name = "entityManagerFactory")
|
||||
public BatchConfigurer jpaBatchConfigurer(DataSource dataSource,
|
||||
public BasicBatchConfigurer jpaBatchConfigurer(DataSource dataSource,
|
||||
EntityManagerFactory entityManagerFactory) {
|
||||
return new BasicBatchConfigurer(this.properties, dataSource,
|
||||
entityManagerFactory);
|
||||
@ -147,7 +147,7 @@ public class BatchAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(name = "entityManagerFactory")
|
||||
public BatchConfigurer basicBatchConfigurer(DataSource dataSource) {
|
||||
public BasicBatchConfigurer basicBatchConfigurer(DataSource dataSource) {
|
||||
return new BasicBatchConfigurer(this.properties, dataSource);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public class CacheAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@Role(BeanDefinition.ROLE_INFRASTRUCTURE)
|
||||
public static BeanFactoryPostProcessor cacheAutoConfigurationValidatorPostProcessor() {
|
||||
public static CacheManagerValidatorPostProcessor cacheAutoConfigurationValidatorPostProcessor() {
|
||||
return new CacheManagerValidatorPostProcessor();
|
||||
}
|
||||
|
||||
|
@ -54,7 +54,8 @@ public class InfinispanCacheConfiguration {
|
||||
private ConfigurationBuilder defaultConfigurationBuilder;
|
||||
|
||||
@Bean
|
||||
public CacheManager cacheManager(EmbeddedCacheManager embeddedCacheManager) {
|
||||
public SpringEmbeddedCacheManager cacheManager(
|
||||
EmbeddedCacheManager embeddedCacheManager) {
|
||||
return new SpringEmbeddedCacheManager(embeddedCacheManager);
|
||||
}
|
||||
|
||||
|
@ -97,7 +97,7 @@ public class JacksonAutoConfiguration {
|
||||
private JacksonProperties jacksonProperties;
|
||||
|
||||
@Bean
|
||||
public Module jodaDateTimeSerializationModule() {
|
||||
public SimpleModule jodaDateTimeSerializationModule() {
|
||||
SimpleModule module = new SimpleModule();
|
||||
JacksonJodaDateFormat jacksonJodaFormat = getJacksonJodaDateFormat();
|
||||
if (jacksonJodaFormat != null) {
|
||||
|
@ -52,9 +52,9 @@ public class DataSourceTransactionManagerAutoConfiguration implements Ordered {
|
||||
private DataSource dataSource;
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnMissingBean(PlatformTransactionManager.class)
|
||||
@ConditionalOnBean(DataSource.class)
|
||||
public PlatformTransactionManager transactionManager() {
|
||||
public DataSourceTransactionManager transactionManager() {
|
||||
return new DataSourceTransactionManager(this.dataSource);
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2013 the original author or authors.
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -17,7 +17,6 @@
|
||||
package org.springframework.boot.autoconfigure.jdbc;
|
||||
|
||||
import javax.annotation.PreDestroy;
|
||||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@ -48,7 +47,7 @@ public class EmbeddedDataSourceConfiguration implements BeanClassLoaderAware {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DataSource dataSource() {
|
||||
public EmbeddedDatabase dataSource() {
|
||||
EmbeddedDatabaseBuilder builder = new EmbeddedDatabaseBuilder()
|
||||
.setType(EmbeddedDatabaseConnection.get(this.classLoader).getType());
|
||||
this.database = builder.setName(this.name).build();
|
||||
|
@ -79,8 +79,8 @@ class JmsAnnotationDrivenConfiguration {
|
||||
protected static class JndiConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public DestinationResolver destinationResolver() {
|
||||
@ConditionalOnMissingBean(DestinationResolver.class)
|
||||
public JndiDestinationResolver destinationResolver() {
|
||||
JndiDestinationResolver resolver = new JndiDestinationResolver();
|
||||
resolver.setFallbackToDynamicDestination(true);
|
||||
return resolver;
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -20,7 +20,9 @@ import javax.jms.ConnectionFactory;
|
||||
|
||||
import org.apache.activemq.ActiveMQConnectionFactory;
|
||||
import org.apache.activemq.pool.PooledConnectionFactory;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@ -30,22 +32,34 @@ import org.springframework.context.annotation.Configuration;
|
||||
* @author Greg Turnquist
|
||||
* @author Stephane Nicoll
|
||||
* @author Phillip Webb
|
||||
* @author Andy Wilkinson
|
||||
* @since 1.1.0
|
||||
*/
|
||||
@Configuration
|
||||
@ConditionalOnMissingBean(ConnectionFactory.class)
|
||||
class ActiveMQConnectionFactoryConfiguration {
|
||||
|
||||
@Bean
|
||||
public ConnectionFactory jmsConnectionFactory(ActiveMQProperties properties) {
|
||||
ActiveMQConnectionFactory connectionFactory = new ActiveMQConnectionFactoryFactory(
|
||||
properties).createConnectionFactory(ActiveMQConnectionFactory.class);
|
||||
if (properties.isPooled()) {
|
||||
PooledConnectionFactory pool = new PooledConnectionFactory();
|
||||
pool.setConnectionFactory(connectionFactory);
|
||||
return pool;
|
||||
@ConditionalOnClass(PooledConnectionFactory.class)
|
||||
static class PooledConnectionFactoryConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "spring.activemq", name = "pooled", havingValue = "true", matchIfMissing = false)
|
||||
public PooledConnectionFactory pooledJmsConnectionFactory(
|
||||
ActiveMQProperties properties) {
|
||||
PooledConnectionFactory pooledConnectionFactory = new PooledConnectionFactory();
|
||||
pooledConnectionFactory
|
||||
.setConnectionFactory(new ActiveMQConnectionFactoryFactory(properties)
|
||||
.createConnectionFactory(ActiveMQConnectionFactory.class));
|
||||
return pooledConnectionFactory;
|
||||
|
||||
}
|
||||
return connectionFactory;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnProperty(prefix = "spring.activemq", name = "pooled", havingValue = "false", matchIfMissing = true)
|
||||
public ActiveMQConnectionFactory jmsConnectionFactory(ActiveMQProperties properties) {
|
||||
return new ActiveMQConnectionFactoryFactory(properties)
|
||||
.createConnectionFactory(ActiveMQConnectionFactory.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -35,8 +35,8 @@ import org.springframework.context.annotation.Configuration;
|
||||
class ArtemisConnectionFactoryConfiguration {
|
||||
|
||||
@Bean
|
||||
public ConnectionFactory jmsConnectionFactory(ListableBeanFactory beanFactory,
|
||||
ArtemisProperties properties) {
|
||||
public ActiveMQConnectionFactory jmsConnectionFactory(
|
||||
ListableBeanFactory beanFactory, ArtemisProperties properties) {
|
||||
return new ArtemisConnectionFactoryFactory(beanFactory, properties)
|
||||
.createConnectionFactory(ActiveMQConnectionFactory.class);
|
||||
}
|
||||
|
@ -53,8 +53,8 @@ class ArtemisXAConnectionFactoryConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConnectionFactory nonXaJmsConnectionFactory(ListableBeanFactory beanFactory,
|
||||
ArtemisProperties properties) {
|
||||
public ActiveMQXAConnectionFactory nonXaJmsConnectionFactory(
|
||||
ListableBeanFactory beanFactory, ArtemisProperties properties) {
|
||||
return new ArtemisConnectionFactoryFactory(beanFactory, properties)
|
||||
.createConnectionFactory(ActiveMQXAConnectionFactory.class);
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -35,7 +35,7 @@ import org.springframework.context.annotation.Configuration;
|
||||
class HornetQConnectionFactoryConfiguration {
|
||||
|
||||
@Bean
|
||||
public ConnectionFactory jmsConnectionFactory(ListableBeanFactory beanFactory,
|
||||
public HornetQConnectionFactory jmsConnectionFactory(ListableBeanFactory beanFactory,
|
||||
HornetQProperties properties) {
|
||||
return new HornetQConnectionFactoryFactory(beanFactory, properties)
|
||||
.createConnectionFactory(HornetQConnectionFactory.class);
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -53,8 +53,8 @@ class HornetQXAConnectionFactoryConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConnectionFactory nonXaJmsConnectionFactory(ListableBeanFactory beanFactory,
|
||||
HornetQProperties properties) {
|
||||
public HornetQConnectionFactory nonXaJmsConnectionFactory(
|
||||
ListableBeanFactory beanFactory, HornetQProperties properties) {
|
||||
return new HornetQConnectionFactoryFactory(beanFactory, properties)
|
||||
.createConnectionFactory(HornetQConnectionFactory.class);
|
||||
}
|
||||
|
@ -64,12 +64,13 @@ public class JooqAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBean(PlatformTransactionManager.class)
|
||||
public TransactionProvider transactionProvider(PlatformTransactionManager txManager) {
|
||||
public SpringTransactionProvider transactionProvider(
|
||||
PlatformTransactionManager txManager) {
|
||||
return new SpringTransactionProvider(txManager);
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ExecuteListenerProvider jooqExceptionTranslatorExecuteListenerProvider() {
|
||||
public DefaultExecuteListenerProvider jooqExceptionTranslatorExecuteListenerProvider() {
|
||||
return new DefaultExecuteListenerProvider(new JooqExceptionTranslator());
|
||||
}
|
||||
|
||||
|
@ -102,8 +102,8 @@ public class MongoDataAutoConfiguration implements BeanClassLoaderAware {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public MongoDbFactory mongoDbFactory(MongoClient mongo) throws Exception {
|
||||
@ConditionalOnMissingBean(MongoDbFactory.class)
|
||||
public SimpleMongoDbFactory mongoDbFactory(MongoClient mongo) throws Exception {
|
||||
String database = this.properties.getMongoClientDatabase();
|
||||
return new SimpleMongoDbFactory(mongo, database);
|
||||
}
|
||||
|
@ -132,8 +132,8 @@ public class RedisAutoConfiguration {
|
||||
AbstractRedisConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public RedisConnectionFactory redisConnectionFactory()
|
||||
@ConditionalOnMissingBean(RedisConnectionFactory.class)
|
||||
public JedisConnectionFactory redisConnectionFactory()
|
||||
throws UnknownHostException {
|
||||
return applyProperties(new JedisConnectionFactory(getSentinelConfig()));
|
||||
}
|
||||
@ -149,8 +149,8 @@ public class RedisAutoConfiguration {
|
||||
AbstractRedisConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public RedisConnectionFactory redisConnectionFactory()
|
||||
@ConditionalOnMissingBean(RedisConnectionFactory.class)
|
||||
public JedisConnectionFactory redisConnectionFactory()
|
||||
throws UnknownHostException {
|
||||
return applyProperties(createJedisConnectionFactory());
|
||||
}
|
||||
|
@ -54,8 +54,8 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
|
||||
public class SecurityAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public AuthenticationEventPublisher authenticationEventPublisher(
|
||||
@ConditionalOnMissingBean(AuthenticationEventPublisher.class)
|
||||
public DefaultAuthenticationEventPublisher authenticationEventPublisher(
|
||||
ApplicationEventPublisher publisher) {
|
||||
return new DefaultAuthenticationEventPublisher(publisher);
|
||||
}
|
||||
|
@ -94,7 +94,7 @@ public class SpringBootWebSecurityConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean({ IgnoredPathsWebSecurityConfigurerAdapter.class })
|
||||
public WebSecurityConfigurer<WebSecurity> ignoredPathsWebSecurityConfigurerAdapter() {
|
||||
public IgnoredPathsWebSecurityConfigurerAdapter ignoredPathsWebSecurityConfigurerAdapter() {
|
||||
return new IgnoredPathsWebSecurityConfigurerAdapter();
|
||||
}
|
||||
|
||||
|
@ -102,7 +102,7 @@ public class OAuth2RestOperationsConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
public OAuth2ClientContext oauth2ClientContext() {
|
||||
public DefaultOAuth2ClientContext oauth2ClientContext() {
|
||||
return new DefaultOAuth2ClientContext(new DefaultAccessTokenRequest());
|
||||
}
|
||||
|
||||
@ -119,7 +119,7 @@ public class OAuth2RestOperationsConfiguration {
|
||||
|
||||
@Bean
|
||||
@Scope(value = "session", proxyMode = ScopedProxyMode.INTERFACES)
|
||||
public OAuth2ClientContext oauth2ClientContext() {
|
||||
public DefaultOAuth2ClientContext oauth2ClientContext() {
|
||||
return new DefaultOAuth2ClientContext(this.accessTokenRequest);
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ public class OAuth2RestOperationsConfiguration {
|
||||
|
||||
@Bean
|
||||
@Scope(value = "request", proxyMode = ScopedProxyMode.INTERFACES)
|
||||
public OAuth2ClientContext oauth2ClientContext() {
|
||||
public DefaultOAuth2ClientContext oauth2ClientContext() {
|
||||
DefaultOAuth2ClientContext context = new DefaultOAuth2ClientContext(
|
||||
new DefaultAccessTokenRequest());
|
||||
Authentication principal = SecurityContextHolder.getContext()
|
||||
|
@ -146,7 +146,7 @@ public class ResourceServerTokenServicesConfiguration {
|
||||
private ResourceServerProperties resource;
|
||||
|
||||
@Bean
|
||||
public ResourceServerTokenServices remoteTokenServices() {
|
||||
public RemoteTokenServices remoteTokenServices() {
|
||||
RemoteTokenServices services = new RemoteTokenServices();
|
||||
services.setCheckTokenEndpointUrl(this.resource.getTokenInfoUri());
|
||||
services.setClientId(this.resource.getClientId());
|
||||
@ -182,7 +182,7 @@ public class ResourceServerTokenServicesConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnMissingBean({ ConnectionFactoryLocator.class,
|
||||
ResourceServerTokenServices.class })
|
||||
public ResourceServerTokenServices userInfoTokenServices() {
|
||||
public UserInfoTokenServices userInfoTokenServices() {
|
||||
UserInfoTokenServices services = new UserInfoTokenServices(
|
||||
this.sso.getUserInfoUri(), this.sso.getClientId());
|
||||
services.setTokenType(this.sso.getTokenType());
|
||||
@ -206,7 +206,7 @@ public class ResourceServerTokenServicesConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(ResourceServerTokenServices.class)
|
||||
public ResourceServerTokenServices userInfoTokenServices() {
|
||||
public UserInfoTokenServices userInfoTokenServices() {
|
||||
UserInfoTokenServices services = new UserInfoTokenServices(
|
||||
this.sso.getUserInfoUri(), this.sso.getClientId());
|
||||
services.setRestTemplate(this.restTemplate);
|
||||
@ -233,7 +233,7 @@ public class ResourceServerTokenServicesConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(ResourceServerTokenServices.class)
|
||||
public ResourceServerTokenServices jwtTokenServices() {
|
||||
public DefaultTokenServices jwtTokenServices() {
|
||||
DefaultTokenServices services = new DefaultTokenServices();
|
||||
services.setTokenStore(jwtTokenStore());
|
||||
return services;
|
||||
|
@ -38,7 +38,6 @@ import org.springframework.social.connect.ConnectionRepository;
|
||||
import org.springframework.social.connect.web.GenericConnectionStatusView;
|
||||
import org.springframework.social.facebook.api.Facebook;
|
||||
import org.springframework.social.facebook.connect.FacebookConnectionFactory;
|
||||
import org.springframework.web.servlet.View;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for Spring Social connectivity with
|
||||
@ -74,7 +73,7 @@ public class FacebookAutoConfiguration {
|
||||
|
||||
@Bean(name = { "connect/facebookConnect", "connect/facebookConnected" })
|
||||
@ConditionalOnProperty(prefix = "spring.social", name = "auto-connection-views")
|
||||
public View facebookConnectView() {
|
||||
public GenericConnectionStatusView facebookConnectView() {
|
||||
return new GenericConnectionStatusView("facebook", "Facebook");
|
||||
}
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -38,7 +38,6 @@ import org.springframework.social.connect.ConnectionRepository;
|
||||
import org.springframework.social.connect.web.GenericConnectionStatusView;
|
||||
import org.springframework.social.linkedin.api.LinkedIn;
|
||||
import org.springframework.social.linkedin.connect.LinkedInConnectionFactory;
|
||||
import org.springframework.web.servlet.View;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for Spring Social connectivity with
|
||||
@ -74,7 +73,7 @@ public class LinkedInAutoConfiguration {
|
||||
|
||||
@Bean(name = { "connect/linkedinConnect", "connect/linkedinConnected" })
|
||||
@ConditionalOnProperty(prefix = "spring.social", name = "auto-connection-views")
|
||||
public View linkedInConnectView() {
|
||||
public GenericConnectionStatusView linkedInConnectView() {
|
||||
return new GenericConnectionStatusView("linkedin", "LinkedIn");
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,6 @@ import org.springframework.social.connect.web.SignInAdapter;
|
||||
import org.springframework.social.connect.web.thymeleaf.SpringSocialDialect;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.web.servlet.ViewResolver;
|
||||
import org.springframework.web.servlet.view.BeanNameViewResolver;
|
||||
import org.thymeleaf.spring4.SpringTemplateEngine;
|
||||
|
||||
@ -98,9 +97,9 @@ public class SocialWebAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(BeanNameViewResolver.class)
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(prefix = "spring.social", name = "auto-connection-views")
|
||||
public ViewResolver beanNameViewResolver() {
|
||||
public BeanNameViewResolver beanNameViewResolver() {
|
||||
BeanNameViewResolver viewResolver = new BeanNameViewResolver();
|
||||
viewResolver.setOrder(Integer.MIN_VALUE);
|
||||
return viewResolver;
|
||||
@ -108,7 +107,7 @@ public class SocialWebAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnBean(SignInAdapter.class)
|
||||
@ConditionalOnMissingBean(ProviderSignInController.class)
|
||||
@ConditionalOnMissingBean
|
||||
public ProviderSignInController signInController(
|
||||
ConnectionFactoryLocator factoryLocator,
|
||||
UsersConnectionRepository usersRepository, SignInAdapter signInAdapter) {
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@ -39,7 +39,6 @@ import org.springframework.social.connect.web.GenericConnectionStatusView;
|
||||
import org.springframework.social.twitter.api.Twitter;
|
||||
import org.springframework.social.twitter.api.impl.TwitterTemplate;
|
||||
import org.springframework.social.twitter.connect.TwitterConnectionFactory;
|
||||
import org.springframework.web.servlet.View;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for Spring Social connectivity with
|
||||
@ -79,7 +78,7 @@ public class TwitterAutoConfiguration {
|
||||
|
||||
@Bean(name = { "connect/twitterConnect", "connect/twitterConnected" })
|
||||
@ConditionalOnProperty(prefix = "spring.social", name = "auto-connection-views")
|
||||
public View twitterConnectView() {
|
||||
public GenericConnectionStatusView twitterConnectView() {
|
||||
return new GenericConnectionStatusView("twitter", "Twitter");
|
||||
}
|
||||
|
||||
|
@ -68,8 +68,8 @@ class AtomikosJtaConfiguration {
|
||||
}
|
||||
|
||||
@Bean(initMethod = "init", destroyMethod = "shutdownForce")
|
||||
@ConditionalOnMissingBean
|
||||
public UserTransactionService userTransactionService(
|
||||
@ConditionalOnMissingBean(UserTransactionService.class)
|
||||
public UserTransactionServiceImp userTransactionService(
|
||||
AtomikosProperties atomikosProperties) {
|
||||
Properties properties = new Properties();
|
||||
if (StringUtils.hasText(this.jtaProperties.getTransactionManagerId())) {
|
||||
@ -100,8 +100,8 @@ class AtomikosJtaConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public XADataSourceWrapper xaDataSourceWrapper() {
|
||||
@ConditionalOnMissingBean(XADataSourceWrapper.class)
|
||||
public AtomikosXADataSourceWrapper xaDataSourceWrapper() {
|
||||
return new AtomikosXADataSourceWrapper();
|
||||
}
|
||||
|
||||
@ -122,8 +122,8 @@ class AtomikosJtaConfiguration {
|
||||
static class AtomikosJtaJmsConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public XAConnectionFactoryWrapper xaConnectionFactoryWrapper() {
|
||||
@ConditionalOnMissingBean(XAConnectionFactoryWrapper.class)
|
||||
public AtomikosXAConnectionFactoryWrapper xaConnectionFactoryWrapper() {
|
||||
return new AtomikosXAConnectionFactoryWrapper();
|
||||
}
|
||||
|
||||
|
@ -37,6 +37,7 @@ import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.jta.JtaTransactionManager;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import bitronix.tm.BitronixTransactionManager;
|
||||
import bitronix.tm.TransactionManagerServices;
|
||||
import bitronix.tm.jndi.BitronixContext;
|
||||
|
||||
@ -80,16 +81,16 @@ class BitronixJtaConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public TransactionManager bitronixTransactionManager(
|
||||
@ConditionalOnMissingBean(TransactionManager.class)
|
||||
public BitronixTransactionManager bitronixTransactionManager(
|
||||
bitronix.tm.Configuration configuration) {
|
||||
// Inject configuration to force ordering
|
||||
return TransactionManagerServices.getTransactionManager();
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public XADataSourceWrapper xaDataSourceWrapper() {
|
||||
@ConditionalOnMissingBean(XADataSourceWrapper.class)
|
||||
public BitronixXADataSourceWrapper xaDataSourceWrapper() {
|
||||
return new BitronixXADataSourceWrapper();
|
||||
}
|
||||
|
||||
@ -108,8 +109,8 @@ class BitronixJtaConfiguration {
|
||||
static class BitronixJtaJmsConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public XAConnectionFactoryWrapper xaConnectionFactoryWrapper() {
|
||||
@ConditionalOnMissingBean(XAConnectionFactoryWrapper.class)
|
||||
public BitronixXAConnectionFactoryWrapper xaConnectionFactoryWrapper() {
|
||||
return new BitronixXAConnectionFactoryWrapper();
|
||||
}
|
||||
}
|
||||
|
@ -45,7 +45,6 @@ import org.springframework.util.Assert;
|
||||
import org.springframework.web.servlet.resource.ResourceUrlEncodingFilter;
|
||||
import org.springframework.web.servlet.view.velocity.VelocityConfig;
|
||||
import org.springframework.web.servlet.view.velocity.VelocityConfigurer;
|
||||
import org.springframework.web.servlet.view.velocity.VelocityViewResolver;
|
||||
|
||||
/**
|
||||
* {@link EnableAutoConfiguration Auto-configuration} for Velocity.
|
||||
@ -130,7 +129,7 @@ public class VelocityAutoConfiguration {
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(name = "velocityViewResolver")
|
||||
@ConditionalOnProperty(name = "spring.velocity.enabled", matchIfMissing = true)
|
||||
public VelocityViewResolver velocityViewResolver() {
|
||||
public EmbeddedVelocityViewResolver velocityViewResolver() {
|
||||
EmbeddedVelocityViewResolver resolver = new EmbeddedVelocityViewResolver();
|
||||
this.properties.applyToViewResolver(resolver);
|
||||
return resolver;
|
||||
|
@ -62,7 +62,7 @@ public class MultipartAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean(name = DispatcherServlet.MULTIPART_RESOLVER_BEAN_NAME)
|
||||
@ConditionalOnMissingBean(value = MultipartResolver.class)
|
||||
@ConditionalOnMissingBean(MultipartResolver.class)
|
||||
public StandardServletMultipartResolver multipartResolver() {
|
||||
return new StandardServletMultipartResolver();
|
||||
}
|
||||
|
@ -147,7 +147,7 @@ public class WebMvcAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(InternalResourceViewResolver.class)
|
||||
@ConditionalOnMissingBean
|
||||
public InternalResourceViewResolver defaultViewResolver() {
|
||||
InternalResourceViewResolver resolver = new InternalResourceViewResolver();
|
||||
resolver.setPrefix(this.mvcProperties.getView().getPrefix());
|
||||
@ -156,7 +156,7 @@ public class WebMvcAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(RequestContextListener.class)
|
||||
@ConditionalOnMissingBean
|
||||
public RequestContextListener requestContextListener() {
|
||||
return new RequestContextListener();
|
||||
}
|
||||
@ -183,7 +183,7 @@ public class WebMvcAutoConfiguration {
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(LocaleResolver.class)
|
||||
@ConditionalOnMissingBean
|
||||
@ConditionalOnProperty(prefix = "spring.mvc", name = "locale")
|
||||
public LocaleResolver localeResolver() {
|
||||
return new FixedLocaleResolver(this.mvcProperties.getLocale());
|
||||
|
@ -25,7 +25,6 @@ import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.web.EmbeddedServletContainerAutoConfiguration;
|
||||
import org.springframework.boot.context.embedded.EmbeddedServletContainerCustomizer;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@ -60,7 +59,7 @@ public class WebSocketAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(name = "websocketContainerCustomizer")
|
||||
public EmbeddedServletContainerCustomizer websocketContainerCustomizer() {
|
||||
public TomcatWebSocketContainerCustomizer websocketContainerCustomizer() {
|
||||
return new TomcatWebSocketContainerCustomizer();
|
||||
}
|
||||
|
||||
@ -72,7 +71,7 @@ public class WebSocketAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(name = "websocketContainerCustomizer")
|
||||
public EmbeddedServletContainerCustomizer websocketContainerCustomizer() {
|
||||
public JettyWebSocketContainerCustomizer websocketContainerCustomizer() {
|
||||
return new JettyWebSocketContainerCustomizer();
|
||||
}
|
||||
|
||||
@ -84,7 +83,7 @@ public class WebSocketAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(name = "websocketContainerCustomizer")
|
||||
public EmbeddedServletContainerCustomizer websocketContainerCustomizer() {
|
||||
public UndertowWebSocketContainerCustomizer websocketContainerCustomizer() {
|
||||
return new UndertowWebSocketContainerCustomizer();
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user