Update auto-configuration @Bean methods to return most specific type
Closes gh-2536 Closes gh-2403
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user