Move to constructor injection in simple configuration classes
This commit updates "simple" configuration classes to use constructor injection. Simple means that there are no optional dependencies (@Autowired(required=false) is not used), and none of the dependencies use generics. Configuration classes that are not simple will be updated in a second pass once https://jira.spring.io/browse/SPR-14015 has been fixed. See gh-5306
This commit is contained in:
parent
398aed7fdb
commit
5009933788
|
@ -103,8 +103,12 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
|
|||
@EnableConfigurationProperties({ HealthIndicatorProperties.class })
|
||||
public class HealthIndicatorAutoConfiguration {
|
||||
|
||||
@Autowired
|
||||
private HealthIndicatorProperties properties = new HealthIndicatorProperties();
|
||||
private final HealthIndicatorProperties properties;
|
||||
|
||||
public HealthIndicatorAutoConfiguration(
|
||||
HealthIndicatorProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(HealthAggregator.class)
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.Properties;
|
|||
|
||||
import org.jolokia.http.AgentServlet;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.autoconfigure.JolokiaAutoConfiguration.JolokiaCondition;
|
||||
import org.springframework.boot.actuate.endpoint.mvc.JolokiaMvcEndpoint;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
|
@ -69,8 +68,11 @@ import org.springframework.web.servlet.mvc.ServletWrappingController;
|
|||
@EnableConfigurationProperties(JolokiaProperties.class)
|
||||
public class JolokiaAutoConfiguration {
|
||||
|
||||
@Autowired
|
||||
JolokiaProperties properties = new JolokiaProperties();
|
||||
private final JolokiaProperties properties;
|
||||
|
||||
public JolokiaAutoConfiguration(JolokiaProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -19,7 +19,6 @@ package org.springframework.boot.actuate.autoconfigure;
|
|||
import javax.servlet.Servlet;
|
||||
import javax.servlet.ServletRegistration;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.metrics.CounterService;
|
||||
import org.springframework.boot.actuate.metrics.GaugeService;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
|
@ -48,11 +47,15 @@ import org.springframework.web.servlet.HandlerMapping;
|
|||
@ConditionalOnProperty(name = "endpoints.metrics.filter.enabled", matchIfMissing = true)
|
||||
public class MetricFilterAutoConfiguration {
|
||||
|
||||
@Autowired
|
||||
private CounterService counterService;
|
||||
private final CounterService counterService;
|
||||
|
||||
@Autowired
|
||||
private GaugeService gaugeService;
|
||||
private final GaugeService gaugeService;
|
||||
|
||||
public MetricFilterAutoConfiguration(CounterService counterService,
|
||||
GaugeService gaugeService) {
|
||||
this.counterService = counterService;
|
||||
this.gaugeService = gaugeService;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public MetricsFilter metricFilter() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -18,7 +18,6 @@ package org.springframework.boot.actuate.autoconfigure;
|
|||
|
||||
import com.codahale.metrics.MetricRegistry;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.metrics.CounterService;
|
||||
import org.springframework.boot.actuate.metrics.GaugeService;
|
||||
import org.springframework.boot.actuate.metrics.buffer.BufferCounterService;
|
||||
|
@ -86,9 +85,11 @@ public class MetricRepositoryAutoConfiguration {
|
|||
@ConditionalOnMissingBean(GaugeService.class)
|
||||
static class LegacyMetricServicesConfiguration {
|
||||
|
||||
@Autowired
|
||||
@ActuatorMetricWriter
|
||||
private MetricWriter writer;
|
||||
private final MetricWriter writer;
|
||||
|
||||
LegacyMetricServicesConfiguration(@ActuatorMetricWriter MetricWriter writer) {
|
||||
this.writer = writer;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(CounterService.class)
|
||||
|
|
|
@ -22,7 +22,6 @@ import javax.annotation.PostConstruct;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.endpoint.AutoConfigurationReportEndpoint.Report;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionEvaluationReport;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
|
||||
|
@ -66,8 +65,11 @@ public class AutoConfigurationReportEndpointTests
|
|||
@EnableConfigurationProperties
|
||||
public static class Config {
|
||||
|
||||
@Autowired
|
||||
private ConfigurableApplicationContext context;
|
||||
private final ConfigurableApplicationContext context;
|
||||
|
||||
public Config(ConfigurableApplicationContext context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void setupAutoConfigurationReport() {
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.springframework.boot.actuate.endpoint;
|
|||
import org.flywaydb.core.Flyway;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
@ -48,12 +47,9 @@ public class FlywayEndpointTests extends AbstractEndpointTests<FlywayEndpoint> {
|
|||
@Import({ EmbeddedDataSourceConfiguration.class, FlywayAutoConfiguration.class })
|
||||
public static class Config {
|
||||
|
||||
@Autowired
|
||||
private Flyway flyway;
|
||||
|
||||
@Bean
|
||||
public FlywayEndpoint endpoint() {
|
||||
return new FlywayEndpoint(this.flyway);
|
||||
public FlywayEndpoint endpoint(Flyway flyway) {
|
||||
return new FlywayEndpoint(flyway);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.springframework.boot.actuate.endpoint;
|
|||
import liquibase.integration.spring.SpringLiquibase;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
|
||||
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
@ -49,8 +48,11 @@ public class LiquibaseEndpointTests extends AbstractEndpointTests<LiquibaseEndpo
|
|||
@Import({ EmbeddedDataSourceConfiguration.class, LiquibaseAutoConfiguration.class })
|
||||
public static class Config {
|
||||
|
||||
@Autowired
|
||||
private SpringLiquibase liquibase;
|
||||
private final SpringLiquibase liquibase;
|
||||
|
||||
public Config(SpringLiquibase liquibase) {
|
||||
this.liquibase = liquibase;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LiquibaseEndpoint endpoint() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -132,8 +132,11 @@ public class BatchAutoConfiguration {
|
|||
@Configuration
|
||||
protected static class JpaBatchConfiguration {
|
||||
|
||||
@Autowired
|
||||
private BatchProperties properties;
|
||||
private final BatchProperties properties;
|
||||
|
||||
protected JpaBatchConfiguration(BatchProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
// The EntityManagerFactory may not be discoverable by type when this condition
|
||||
// is evaluated, so we need a well-known bean name. This is the one used by Spring
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.cache;
|
|||
import net.sf.ehcache.Cache;
|
||||
import net.sf.ehcache.CacheManager;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ResourceCondition;
|
||||
|
@ -45,11 +44,15 @@ import org.springframework.core.io.Resource;
|
|||
EhCacheCacheConfiguration.ConfigAvailableCondition.class })
|
||||
class EhCacheCacheConfiguration {
|
||||
|
||||
@Autowired
|
||||
private CacheProperties cacheProperties;
|
||||
private final CacheProperties cacheProperties;
|
||||
|
||||
@Autowired
|
||||
private CacheManagerCustomizers customizers;
|
||||
private final CacheManagerCustomizers customizers;
|
||||
|
||||
EhCacheCacheConfiguration(CacheProperties cacheProperties,
|
||||
CacheManagerCustomizers customizers) {
|
||||
this.cacheProperties = cacheProperties;
|
||||
this.customizers = customizers;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public EhCacheCacheManager cacheManager(CacheManager ehCacheCacheManager) {
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.cache;
|
|||
|
||||
import java.util.Collection;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.cache.Cache;
|
||||
|
@ -41,8 +40,11 @@ import org.springframework.context.annotation.Configuration;
|
|||
@Conditional(CacheCondition.class)
|
||||
class GenericCacheConfiguration {
|
||||
|
||||
@Autowired
|
||||
private CacheManagerCustomizers customizers;
|
||||
private final CacheManagerCustomizers customizers;
|
||||
|
||||
GenericCacheConfiguration(CacheManagerCustomizers customizers) {
|
||||
this.customizers = customizers;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SimpleCacheManager cacheManager(Collection<Cache> caches) {
|
||||
|
|
|
@ -23,7 +23,6 @@ import com.hazelcast.core.Hazelcast;
|
|||
import com.hazelcast.core.HazelcastInstance;
|
||||
import com.hazelcast.spring.cache.HazelcastCacheManager;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate;
|
||||
import org.springframework.boot.autoconfigure.hazelcast.HazelcastConfigResourceCondition;
|
||||
|
@ -45,11 +44,14 @@ abstract class HazelcastInstanceConfiguration {
|
|||
@ConditionalOnSingleCandidate(HazelcastInstance.class)
|
||||
static class Existing {
|
||||
|
||||
@Autowired
|
||||
private CacheProperties cacheProperties;
|
||||
private final CacheProperties cacheProperties;
|
||||
|
||||
@Autowired
|
||||
private CacheManagerCustomizers customizers;
|
||||
private final CacheManagerCustomizers customizers;
|
||||
|
||||
Existing(CacheProperties cacheProperties, CacheManagerCustomizers customizers) {
|
||||
this.cacheProperties = cacheProperties;
|
||||
this.customizers = customizers;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HazelcastCacheManager cacheManager(
|
||||
|
@ -72,11 +74,14 @@ abstract class HazelcastInstanceConfiguration {
|
|||
@Conditional(ConfigAvailableCondition.class)
|
||||
static class Specific {
|
||||
|
||||
@Autowired
|
||||
private CacheProperties cacheProperties;
|
||||
private final CacheProperties cacheProperties;
|
||||
|
||||
@Autowired
|
||||
private CacheManagerCustomizers customizers;
|
||||
private final CacheManagerCustomizers customizers;
|
||||
|
||||
Specific(CacheProperties cacheProperties, CacheManagerCustomizers customizers) {
|
||||
this.cacheProperties = cacheProperties;
|
||||
this.customizers = customizers;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HazelcastInstance hazelcastInstance() throws IOException {
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.cache;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
|
@ -43,11 +42,15 @@ import org.springframework.data.redis.core.RedisTemplate;
|
|||
@Conditional(CacheCondition.class)
|
||||
class RedisCacheConfiguration {
|
||||
|
||||
@Autowired
|
||||
private CacheProperties cacheProperties;
|
||||
private final CacheProperties cacheProperties;
|
||||
|
||||
@Autowired
|
||||
private CacheManagerCustomizers customizerInvoker;
|
||||
private final CacheManagerCustomizers customizerInvoker;
|
||||
|
||||
RedisCacheConfiguration(CacheProperties cacheProperties,
|
||||
CacheManagerCustomizers customizerInvoker) {
|
||||
this.cacheProperties = cacheProperties;
|
||||
this.customizerInvoker = customizerInvoker;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RedisCacheManager cacheManager(RedisTemplate<Object, Object> redisTemplate) {
|
||||
|
|
|
@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.cache;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.cache.CacheManager;
|
||||
import org.springframework.cache.concurrent.ConcurrentMapCacheManager;
|
||||
|
@ -37,11 +36,15 @@ import org.springframework.context.annotation.Configuration;
|
|||
@Conditional(CacheCondition.class)
|
||||
class SimpleCacheConfiguration {
|
||||
|
||||
@Autowired
|
||||
private CacheProperties cacheProperties;
|
||||
private final CacheProperties cacheProperties;
|
||||
|
||||
@Autowired
|
||||
private CacheManagerCustomizers customizerInvoker;
|
||||
private final CacheManagerCustomizers customizerInvoker;
|
||||
|
||||
SimpleCacheConfiguration(CacheProperties cacheProperties,
|
||||
CacheManagerCustomizers customizerInvoker) {
|
||||
this.cacheProperties = cacheProperties;
|
||||
this.customizerInvoker = customizerInvoker;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConcurrentMapCacheManager cacheManager() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -24,7 +24,6 @@ import com.datastax.driver.core.policies.ReconnectionPolicy;
|
|||
import com.datastax.driver.core.policies.RetryPolicy;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
|
@ -45,8 +44,11 @@ import org.springframework.util.StringUtils;
|
|||
@EnableConfigurationProperties(CassandraProperties.class)
|
||||
public class CassandraAutoConfiguration {
|
||||
|
||||
@Autowired
|
||||
private CassandraProperties properties;
|
||||
private final CassandraProperties properties;
|
||||
|
||||
public CassandraAutoConfiguration(CassandraProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
|
|
|
@ -22,7 +22,6 @@ import javax.validation.Validator;
|
|||
|
||||
import com.couchbase.client.java.CouchbaseBucket;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.AnyNestedCondition;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
|
@ -62,8 +61,11 @@ public class CouchbaseAutoConfiguration {
|
|||
@ConditionalOnMissingBean(AbstractCouchbaseConfiguration.class)
|
||||
public static class CouchbaseConfiguration extends AbstractCouchbaseConfiguration {
|
||||
|
||||
@Autowired
|
||||
private CouchbaseProperties properties;
|
||||
private final CouchbaseProperties properties;
|
||||
|
||||
public CouchbaseConfiguration(CouchbaseProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected List<String> getBootstrapHosts() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.data.cassandra;
|
|||
import com.datastax.driver.core.Cluster;
|
||||
import com.datastax.driver.core.Session;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.cassandra.CassandraAutoConfiguration;
|
||||
|
@ -51,11 +50,15 @@ import org.springframework.data.cassandra.mapping.CassandraMappingContext;
|
|||
@AutoConfigureAfter(CassandraAutoConfiguration.class)
|
||||
public class CassandraDataAutoConfiguration {
|
||||
|
||||
@Autowired
|
||||
private CassandraProperties properties;
|
||||
private final CassandraProperties properties;
|
||||
|
||||
@Autowired
|
||||
private Cluster cluster;
|
||||
private final Cluster cluster;
|
||||
|
||||
public CassandraDataAutoConfiguration(CassandraProperties properties,
|
||||
Cluster cluster) {
|
||||
this.properties = properties;
|
||||
this.cluster = cluster;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
|
|
|
@ -31,7 +31,6 @@ import org.elasticsearch.node.Node;
|
|||
import org.elasticsearch.node.NodeBuilder;
|
||||
|
||||
import org.springframework.beans.factory.DisposableBean;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
|
@ -69,11 +68,14 @@ public class ElasticsearchAutoConfiguration implements DisposableBean {
|
|||
private static final Log logger = LogFactory
|
||||
.getLog(ElasticsearchAutoConfiguration.class);
|
||||
|
||||
@Autowired
|
||||
private ElasticsearchProperties properties;
|
||||
private final ElasticsearchProperties properties;
|
||||
|
||||
private Releasable releasable;
|
||||
|
||||
public ElasticsearchAutoConfiguration(ElasticsearchProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
public Client elasticsearchClient() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -30,7 +30,6 @@ import org.springframework.beans.BeanUtils;
|
|||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigurationPackages;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
|
@ -87,17 +86,21 @@ import org.springframework.util.StringUtils;
|
|||
@AutoConfigureAfter(MongoAutoConfiguration.class)
|
||||
public class MongoDataAutoConfiguration implements BeanClassLoaderAware {
|
||||
|
||||
@Autowired
|
||||
private MongoProperties properties;
|
||||
private final MongoProperties properties;
|
||||
|
||||
@Autowired
|
||||
private Environment environment;
|
||||
private final Environment environment;
|
||||
|
||||
@Autowired
|
||||
private ResourceLoader resourceLoader;
|
||||
private final ResourceLoader resourceLoader;
|
||||
|
||||
private ClassLoader classLoader;
|
||||
|
||||
public MongoDataAutoConfiguration(MongoProperties properties, Environment environment,
|
||||
ResourceLoader resourceLoader) {
|
||||
this.properties = properties;
|
||||
this.environment = environment;
|
||||
this.resourceLoader = resourceLoader;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
this.classLoader = classLoader;
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.data.rest;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.rest.core.config.RepositoryRestConfiguration;
|
||||
|
@ -33,8 +32,11 @@ import org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguratio
|
|||
@Configuration
|
||||
class SpringBootRepositoryRestMvcConfiguration extends RepositoryRestMvcConfiguration {
|
||||
|
||||
@Autowired
|
||||
private RepositoryRestProperties properties;
|
||||
private final RepositoryRestProperties properties;
|
||||
|
||||
SpringBootRepositoryRestMvcConfiguration(RepositoryRestProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@Override
|
||||
|
|
|
@ -66,11 +66,15 @@ public class FreeMarkerAutoConfiguration {
|
|||
private static final Log logger = LogFactory
|
||||
.getLog(FreeMarkerAutoConfiguration.class);
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
@Autowired
|
||||
private FreeMarkerProperties properties;
|
||||
private final FreeMarkerProperties properties;
|
||||
|
||||
public FreeMarkerAutoConfiguration(ApplicationContext applicationContext,
|
||||
FreeMarkerProperties properties) {
|
||||
this.applicationContext = applicationContext;
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void checkTemplateLocationExists() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -137,8 +137,11 @@ public class GroovyTemplateAutoConfiguration {
|
|||
@ConditionalOnProperty(name = "spring.groovy.template.enabled", matchIfMissing = true)
|
||||
public static class GroovyWebConfiguration {
|
||||
|
||||
@Autowired
|
||||
private GroovyTemplateProperties properties;
|
||||
private final GroovyTemplateProperties properties;
|
||||
|
||||
public GroovyWebConfiguration(GroovyTemplateProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(name = "groovyMarkupViewResolver")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -51,8 +51,11 @@ import org.springframework.security.config.annotation.web.configuration.WebSecur
|
|||
@AutoConfigureAfter(SecurityAutoConfiguration.class)
|
||||
public class H2ConsoleAutoConfiguration {
|
||||
|
||||
@Autowired
|
||||
private H2ConsoleProperties properties;
|
||||
private final H2ConsoleProperties properties;
|
||||
|
||||
public H2ConsoleAutoConfiguration(H2ConsoleProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ServletRegistrationBean h2Console() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -22,7 +22,6 @@ import com.hazelcast.config.Config;
|
|||
import com.hazelcast.core.Hazelcast;
|
||||
import com.hazelcast.core.HazelcastInstance;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
|
@ -53,8 +52,11 @@ public class HazelcastAutoConfiguration {
|
|||
@Conditional(ConfigAvailableCondition.class)
|
||||
static class HazelcastConfigFileConfiguration {
|
||||
|
||||
@Autowired
|
||||
private HazelcastProperties hazelcastProperties;
|
||||
private final HazelcastProperties hazelcastProperties;
|
||||
|
||||
HazelcastConfigFileConfiguration(HazelcastProperties hazelcastProperties) {
|
||||
this.hazelcastProperties = hazelcastProperties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public HazelcastInstance hazelcastInstance() throws IOException {
|
||||
|
|
|
@ -41,7 +41,6 @@ import org.joda.time.format.DateTimeFormat;
|
|||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.BeanFactoryUtils;
|
||||
import org.springframework.beans.factory.ListableBeanFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnJava;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnJava.JavaVersion;
|
||||
|
@ -97,8 +96,11 @@ public class JacksonAutoConfiguration {
|
|||
private static final Log logger = LogFactory
|
||||
.getLog(JodaDateTimeJacksonConfiguration.class);
|
||||
|
||||
@Autowired
|
||||
private JacksonProperties jacksonProperties;
|
||||
private final JacksonProperties jacksonProperties;
|
||||
|
||||
JodaDateTimeJacksonConfiguration(JacksonProperties jacksonProperties) {
|
||||
this.jacksonProperties = jacksonProperties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SimpleModule jodaDateTimeSerializationModule() {
|
||||
|
@ -155,11 +157,15 @@ public class JacksonAutoConfiguration {
|
|||
@EnableConfigurationProperties(JacksonProperties.class)
|
||||
static class JacksonObjectMapperBuilderConfiguration {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
@Autowired
|
||||
private JacksonProperties jacksonProperties;
|
||||
private final JacksonProperties jacksonProperties;
|
||||
|
||||
JacksonObjectMapperBuilderConfiguration(ApplicationContext applicationContext,
|
||||
JacksonProperties jacksonProperties) {
|
||||
this.applicationContext = applicationContext;
|
||||
this.jacksonProperties = jacksonProperties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(Jackson2ObjectMapperBuilder.class)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.jdbc;
|
|||
import javax.annotation.PreDestroy;
|
||||
|
||||
import org.springframework.beans.factory.BeanClassLoaderAware;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
@ -41,8 +40,11 @@ public class EmbeddedDataSourceConfiguration implements BeanClassLoaderAware {
|
|||
|
||||
private ClassLoader classLoader;
|
||||
|
||||
@Autowired
|
||||
private DataSourceProperties properties;
|
||||
private final DataSourceProperties properties;
|
||||
|
||||
public EmbeddedDataSourceConfiguration(DataSourceProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setBeanClassLoader(ClassLoader classLoader) {
|
||||
|
|
|
@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.jdbc;
|
|||
import javax.sql.DataSource;
|
||||
|
||||
import org.springframework.beans.factory.NoSuchBeanDefinitionException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
@ -50,8 +49,11 @@ import org.springframework.jmx.support.JmxUtils;
|
|||
@EnableConfigurationProperties(DataSourceProperties.class)
|
||||
public class JndiDataSourceAutoConfiguration {
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext context;
|
||||
private final ApplicationContext context;
|
||||
|
||||
public JndiDataSourceAutoConfiguration(ApplicationContext context) {
|
||||
this.context = context;
|
||||
}
|
||||
|
||||
@Bean(destroyMethod = "")
|
||||
@ConditionalOnMissingBean
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -21,7 +21,6 @@ import java.util.Arrays;
|
|||
import javax.jms.ConnectionFactory;
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.AnyNestedCondition;
|
||||
|
@ -56,8 +55,11 @@ public class JndiConnectionFactoryAutoConfiguration {
|
|||
private static String[] JNDI_LOCATIONS = { "java:/JmsXA",
|
||||
"java:/XAConnectionFactory" };
|
||||
|
||||
@Autowired
|
||||
private JmsProperties properties;
|
||||
private final JmsProperties properties;
|
||||
|
||||
public JndiConnectionFactoryAutoConfiguration(JmsProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ConnectionFactory connectionFactory() throws NamingException {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -23,7 +23,6 @@ import javax.sql.DataSource;
|
|||
import liquibase.integration.spring.SpringLiquibase;
|
||||
import liquibase.servicelocator.ServiceLocator;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
|
@ -39,7 +38,6 @@ import org.springframework.boot.liquibase.CommonsLoggingLiquibaseLogger;
|
|||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.context.annotation.Import;
|
||||
import org.springframework.core.io.DefaultResourceLoader;
|
||||
import org.springframework.core.io.Resource;
|
||||
import org.springframework.core.io.ResourceLoader;
|
||||
import org.springframework.orm.jpa.AbstractEntityManagerFactoryBean;
|
||||
|
@ -68,14 +66,18 @@ public class LiquibaseAutoConfiguration {
|
|||
@Import(LiquibaseJpaDependencyConfiguration.class)
|
||||
public static class LiquibaseConfiguration {
|
||||
|
||||
@Autowired
|
||||
private LiquibaseProperties properties = new LiquibaseProperties();
|
||||
private final LiquibaseProperties properties;
|
||||
|
||||
@Autowired
|
||||
private ResourceLoader resourceLoader = new DefaultResourceLoader();
|
||||
private final ResourceLoader resourceLoader;
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
private final DataSource dataSource;
|
||||
|
||||
public LiquibaseConfiguration(LiquibaseProperties properties,
|
||||
ResourceLoader resourceLoader, DataSource dataSource) {
|
||||
this.properties = properties;
|
||||
this.resourceLoader = resourceLoader;
|
||||
this.dataSource = dataSource;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void checkChangelogExists() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.mail;
|
|||
import javax.mail.Session;
|
||||
import javax.naming.NamingException;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnJndi;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
|
@ -40,8 +39,11 @@ import org.springframework.jndi.JndiLocatorDelegate;
|
|||
@ConditionalOnJndi
|
||||
class JndiSessionConfiguration {
|
||||
|
||||
@Autowired
|
||||
private MailProperties properties;
|
||||
private final MailProperties properties;
|
||||
|
||||
JndiSessionConfiguration(MailProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.mail;
|
|||
import javax.annotation.PostConstruct;
|
||||
import javax.mail.MessagingException;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||
|
@ -41,8 +40,11 @@ import org.springframework.mail.javamail.JavaMailSenderImpl;
|
|||
@ConditionalOnSingleCandidate(JavaMailSenderImpl.class)
|
||||
public class MailSenderValidatorAutoConfiguration {
|
||||
|
||||
@Autowired
|
||||
private JavaMailSenderImpl mailSender;
|
||||
private final JavaMailSenderImpl mailSender;
|
||||
|
||||
public MailSenderValidatorAutoConfiguration(JavaMailSenderImpl mailSender) {
|
||||
this.mailSender = mailSender;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void validateConnection() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -98,8 +98,12 @@ public class DeviceDelegatingViewResolverAutoConfiguration {
|
|||
protected static class ThymeleafViewResolverViewResolverDelegateConfiguration
|
||||
extends AbstractDelegateConfiguration {
|
||||
|
||||
@Autowired
|
||||
private ThymeleafViewResolver viewResolver;
|
||||
private final ThymeleafViewResolver viewResolver;
|
||||
|
||||
protected ThymeleafViewResolverViewResolverDelegateConfiguration(
|
||||
ThymeleafViewResolver viewResolver) {
|
||||
this.viewResolver = viewResolver;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LiteDeviceDelegatingViewResolver deviceDelegatingViewResolver() {
|
||||
|
@ -120,8 +124,12 @@ public class DeviceDelegatingViewResolverAutoConfiguration {
|
|||
protected static class InternalResourceViewResolverDelegateConfiguration
|
||||
extends AbstractDelegateConfiguration {
|
||||
|
||||
@Autowired
|
||||
private InternalResourceViewResolver viewResolver;
|
||||
private final InternalResourceViewResolver viewResolver;
|
||||
|
||||
protected InternalResourceViewResolverDelegateConfiguration(
|
||||
InternalResourceViewResolver viewResolver) {
|
||||
this.viewResolver = viewResolver;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public LiteDeviceDelegatingViewResolver deviceDelegatingViewResolver() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.mobile;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
@ -45,26 +44,34 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
|
|||
@ConditionalOnClass({ DeviceResolverHandlerInterceptor.class,
|
||||
DeviceHandlerMethodArgumentResolver.class })
|
||||
@AutoConfigureAfter(WebMvcAutoConfiguration.class)
|
||||
@ConditionalOnWebApplication
|
||||
public class DeviceResolverAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(DeviceResolverHandlerInterceptor.class)
|
||||
public DeviceResolverHandlerInterceptor deviceResolverHandlerInterceptor() {
|
||||
return new DeviceResolverHandlerInterceptor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public DeviceHandlerMethodArgumentResolver deviceHandlerMethodArgumentResolver() {
|
||||
return new DeviceHandlerMethodArgumentResolver();
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnWebApplication
|
||||
@Order(0)
|
||||
protected static class DeviceResolverMvcConfiguration
|
||||
extends WebMvcConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
private DeviceResolverHandlerInterceptor deviceResolverHandlerInterceptor;
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(DeviceResolverHandlerInterceptor.class)
|
||||
public DeviceResolverHandlerInterceptor deviceResolverHandlerInterceptor() {
|
||||
return new DeviceResolverHandlerInterceptor();
|
||||
}
|
||||
private DeviceHandlerMethodArgumentResolver deviceHandlerMethodArgumentResolver;
|
||||
|
||||
@Bean
|
||||
public DeviceHandlerMethodArgumentResolver deviceHandlerMethodArgumentResolver() {
|
||||
return new DeviceHandlerMethodArgumentResolver();
|
||||
protected DeviceResolverMvcConfiguration(
|
||||
DeviceResolverHandlerInterceptor deviceResolverHandlerInterceptor,
|
||||
DeviceHandlerMethodArgumentResolver deviceHandlerMethodArgumentResolver) {
|
||||
this.deviceResolverHandlerInterceptor = deviceResolverHandlerInterceptor;
|
||||
this.deviceHandlerMethodArgumentResolver = deviceHandlerMethodArgumentResolver;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -75,7 +82,7 @@ public class DeviceResolverAutoConfiguration {
|
|||
@Override
|
||||
public void addArgumentResolvers(
|
||||
List<HandlerMethodArgumentResolver> argumentResolvers) {
|
||||
argumentResolvers.add(deviceHandlerMethodArgumentResolver());
|
||||
argumentResolvers.add(this.deviceHandlerMethodArgumentResolver);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -18,7 +18,6 @@ package org.springframework.boot.autoconfigure.mobile;
|
|||
|
||||
import java.util.List;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
@ -48,25 +47,33 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
|
|||
SitePreferenceHandlerMethodArgumentResolver.class })
|
||||
@AutoConfigureAfter(DeviceResolverAutoConfiguration.class)
|
||||
@ConditionalOnProperty(prefix = "spring.mobile.sitepreference", name = "enabled", havingValue = "true", matchIfMissing = true)
|
||||
@ConditionalOnWebApplication
|
||||
public class SitePreferenceAutoConfiguration {
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(SitePreferenceHandlerInterceptor.class)
|
||||
public SitePreferenceHandlerInterceptor sitePreferenceHandlerInterceptor() {
|
||||
return new SitePreferenceHandlerInterceptor();
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SitePreferenceHandlerMethodArgumentResolver sitePreferenceHandlerMethodArgumentResolver() {
|
||||
return new SitePreferenceHandlerMethodArgumentResolver();
|
||||
}
|
||||
|
||||
@Configuration
|
||||
@ConditionalOnWebApplication
|
||||
protected static class SitePreferenceMvcConfiguration
|
||||
extends WebMvcConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
private SitePreferenceHandlerInterceptor sitePreferenceHandlerInterceptor;
|
||||
private final SitePreferenceHandlerInterceptor sitePreferenceHandlerInterceptor;
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(SitePreferenceHandlerInterceptor.class)
|
||||
public SitePreferenceHandlerInterceptor sitePreferenceHandlerInterceptor() {
|
||||
return new SitePreferenceHandlerInterceptor();
|
||||
}
|
||||
private final SitePreferenceHandlerMethodArgumentResolver sitePreferenceHandlerMethodArgumentResolver;
|
||||
|
||||
@Bean
|
||||
public SitePreferenceHandlerMethodArgumentResolver sitePreferenceHandlerMethodArgumentResolver() {
|
||||
return new SitePreferenceHandlerMethodArgumentResolver();
|
||||
protected SitePreferenceMvcConfiguration(
|
||||
SitePreferenceHandlerInterceptor sitePreferenceHandlerInterceptor,
|
||||
org.springframework.mobile.device.site.SitePreferenceHandlerMethodArgumentResolver sitePreferenceHandlerMethodArgumentResolver) {
|
||||
this.sitePreferenceHandlerInterceptor = sitePreferenceHandlerInterceptor;
|
||||
this.sitePreferenceHandlerMethodArgumentResolver = sitePreferenceHandlerMethodArgumentResolver;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -77,7 +84,7 @@ public class SitePreferenceAutoConfiguration {
|
|||
@Override
|
||||
public void addArgumentResolvers(
|
||||
List<HandlerMethodArgumentResolver> argumentResolvers) {
|
||||
argumentResolvers.add(sitePreferenceHandlerMethodArgumentResolver());
|
||||
argumentResolvers.add(this.sitePreferenceHandlerMethodArgumentResolver);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -25,7 +25,6 @@ import com.samskivert.mustache.Mustache.TemplateLoader;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
|
@ -52,14 +51,18 @@ public class MustacheAutoConfiguration {
|
|||
|
||||
private static final Log logger = LogFactory.getLog(MustacheAutoConfiguration.class);
|
||||
|
||||
@Autowired
|
||||
private MustacheProperties mustache;
|
||||
private final MustacheProperties mustache;
|
||||
|
||||
@Autowired
|
||||
private Environment environment;
|
||||
private final Environment environment;
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
public MustacheAutoConfiguration(MustacheProperties mustache, Environment environment,
|
||||
ApplicationContext applicationContext) {
|
||||
this.mustache = mustache;
|
||||
this.environment = environment;
|
||||
this.applicationContext = applicationContext;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void checkTemplateLocationExists() {
|
||||
|
@ -100,8 +103,11 @@ public class MustacheAutoConfiguration {
|
|||
@ConditionalOnWebApplication
|
||||
protected static class MustacheWebConfiguration {
|
||||
|
||||
@Autowired
|
||||
private MustacheProperties mustache;
|
||||
private final MustacheProperties mustache;
|
||||
|
||||
protected MustacheWebConfiguration(MustacheProperties mustache) {
|
||||
this.mustache = mustache;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(MustacheViewResolver.class)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -25,7 +25,6 @@ import javax.sql.DataSource;
|
|||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
|
||||
|
@ -82,11 +81,15 @@ public class HibernateJpaAutoConfiguration extends JpaBaseConfiguration {
|
|||
"org.hibernate.engine.transaction.jta.platform.internal.WebSphereExtendedJtaPlatform",
|
||||
"org.hibernate.service.jta.platform.internal.WebSphereExtendedJtaPlatform", };
|
||||
|
||||
@Autowired
|
||||
private JpaProperties properties;
|
||||
private final JpaProperties properties;
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
private final DataSource dataSource;
|
||||
|
||||
public HibernateJpaAutoConfiguration(JpaProperties properties,
|
||||
DataSource dataSource) {
|
||||
this.properties = properties;
|
||||
this.dataSource = dataSource;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractJpaVendorAdapter createJpaVendorAdapter() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -191,9 +191,12 @@ public class SpringBootWebSecurityConfiguration {
|
|||
protected static class ApplicationWebSecurityConfigurerAdapter
|
||||
extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
private SecurityProperties security;
|
||||
|
||||
protected ApplicationWebSecurityConfigurerAdapter(SecurityProperties security) {
|
||||
this.security = security;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
if (this.security.isRequireSsl()) {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.security.oauth2;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
@ -49,8 +48,11 @@ import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter
|
|||
@EnableConfigurationProperties(OAuth2ClientProperties.class)
|
||||
public class OAuth2AutoConfiguration {
|
||||
|
||||
@Autowired
|
||||
private OAuth2ClientProperties credentials;
|
||||
private final OAuth2ClientProperties credentials;
|
||||
|
||||
public OAuth2AutoConfiguration(OAuth2ClientProperties credentials) {
|
||||
this.credentials = credentials;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ResourceServerProperties resourceServerProperties() {
|
||||
|
|
|
@ -139,8 +139,11 @@ public class OAuth2AuthorizationServerConfiguration
|
|||
@Configuration
|
||||
protected static class ClientDetailsLogger {
|
||||
|
||||
@Autowired
|
||||
private OAuth2ClientProperties credentials;
|
||||
private final OAuth2ClientProperties credentials;
|
||||
|
||||
protected ClientDetailsLogger(OAuth2ClientProperties credentials) {
|
||||
this.credentials = credentials;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void init() {
|
||||
|
@ -158,8 +161,11 @@ public class OAuth2AuthorizationServerConfiguration
|
|||
@ConditionalOnMissingBean(BaseClientDetails.class)
|
||||
protected static class BaseClientDetailsConfiguration {
|
||||
|
||||
@Autowired
|
||||
private OAuth2ClientProperties client;
|
||||
private final OAuth2ClientProperties client;
|
||||
|
||||
protected BaseClientDetailsConfiguration(OAuth2ClientProperties client) {
|
||||
this.client = client;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConfigurationProperties("security.oauth2.client")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.security.oauth2.client;
|
||||
|
||||
import org.springframework.beans.factory.BeanFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
|
||||
import org.springframework.boot.autoconfigure.condition.SpringBootCondition;
|
||||
import org.springframework.boot.autoconfigure.security.SecurityProperties;
|
||||
|
@ -45,11 +44,15 @@ import org.springframework.util.ClassUtils;
|
|||
public class OAuth2SsoDefaultConfiguration extends WebSecurityConfigurerAdapter
|
||||
implements Ordered {
|
||||
|
||||
@Autowired
|
||||
BeanFactory beanFactory;
|
||||
private final BeanFactory beanFactory;
|
||||
|
||||
@Autowired
|
||||
OAuth2SsoProperties sso;
|
||||
private final OAuth2SsoProperties sso;
|
||||
|
||||
public OAuth2SsoDefaultConfiguration(BeanFactory beanFactory,
|
||||
OAuth2SsoProperties sso) {
|
||||
this.beanFactory = beanFactory;
|
||||
this.sso = sso;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
|
|
|
@ -17,7 +17,6 @@
|
|||
package org.springframework.boot.autoconfigure.security.oauth2.resource;
|
||||
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionOutcome;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
@ -64,8 +63,11 @@ import org.springframework.util.StringUtils;
|
|||
@Import(ResourceServerTokenServicesConfiguration.class)
|
||||
public class OAuth2ResourceServerConfiguration {
|
||||
|
||||
@Autowired
|
||||
private ResourceServerProperties resource;
|
||||
private final ResourceServerProperties resource;
|
||||
|
||||
public OAuth2ResourceServerConfiguration(ResourceServerProperties resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(ResourceServerConfigurer.class)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -142,8 +142,11 @@ public class ResourceServerTokenServicesConfiguration {
|
|||
@Conditional(TokenInfoCondition.class)
|
||||
protected static class TokenInfoServicesConfiguration {
|
||||
|
||||
@Autowired
|
||||
private ResourceServerProperties resource;
|
||||
private final ResourceServerProperties resource;
|
||||
|
||||
protected TokenInfoServicesConfiguration(ResourceServerProperties resource) {
|
||||
this.resource = resource;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public RemoteTokenServices remoteTokenServices() {
|
||||
|
|
|
@ -20,7 +20,6 @@ import com.sendgrid.SendGrid;
|
|||
import org.apache.http.HttpHost;
|
||||
import org.apache.http.impl.client.HttpClientBuilder;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.AnyNestedCondition;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
@ -44,8 +43,11 @@ import org.springframework.context.annotation.Configuration;
|
|||
@EnableConfigurationProperties(SendGridProperties.class)
|
||||
public class SendGridAutoConfiguration {
|
||||
|
||||
@Autowired
|
||||
private SendGridProperties properties;
|
||||
private final SendGridProperties properties;
|
||||
|
||||
public SendGridAutoConfiguration(SendGridProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(SendGrid.class)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -16,9 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.session;
|
||||
|
||||
import javax.annotation.PostConstruct;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
|
@ -55,14 +52,18 @@ public class SessionAutoConfiguration {
|
|||
@Configuration
|
||||
public static class SessionRedisHttpConfiguration {
|
||||
|
||||
@Autowired
|
||||
private ServerProperties serverProperties;
|
||||
private final ServerProperties serverProperties;
|
||||
|
||||
@Autowired
|
||||
private RedisOperationsSessionRepository sessionRepository;
|
||||
private final RedisOperationsSessionRepository sessionRepository;
|
||||
|
||||
@PostConstruct
|
||||
public void applyConfigurationProperties() {
|
||||
public SessionRedisHttpConfiguration(ServerProperties serverProperties,
|
||||
RedisOperationsSessionRepository sessionRepository) {
|
||||
this.serverProperties = serverProperties;
|
||||
this.sessionRepository = sessionRepository;
|
||||
applyConfigurationProperties();
|
||||
}
|
||||
|
||||
private void applyConfigurationProperties() {
|
||||
Integer timeout = this.serverProperties.getSession().getTimeout();
|
||||
if (timeout != null) {
|
||||
this.sessionRepository.setDefaultMaxInactiveInterval(timeout);
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.social;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
|
@ -59,8 +58,11 @@ public class FacebookAutoConfiguration {
|
|||
@ConditionalOnWebApplication
|
||||
protected static class FacebookConfigurerAdapter extends SocialAutoConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
private FacebookProperties properties;
|
||||
private final FacebookProperties properties;
|
||||
|
||||
protected FacebookConfigurerAdapter(FacebookProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(Facebook.class)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.social;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
|
@ -59,8 +58,11 @@ public class LinkedInAutoConfiguration {
|
|||
@ConditionalOnWebApplication
|
||||
protected static class LinkedInConfigurerAdapter extends SocialAutoConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
private LinkedInProperties properties;
|
||||
private final LinkedInProperties properties;
|
||||
|
||||
protected LinkedInConfigurerAdapter(LinkedInProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(LinkedIn.class)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.social;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
|
@ -60,8 +59,11 @@ public class TwitterAutoConfiguration {
|
|||
@ConditionalOnWebApplication
|
||||
protected static class TwitterConfigurerAdapter extends SocialAutoConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
private TwitterProperties properties;
|
||||
private final TwitterProperties properties;
|
||||
|
||||
protected TwitterConfigurerAdapter(TwitterProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.apache.solr.client.solrj.SolrClient;
|
|||
import org.apache.solr.client.solrj.impl.CloudSolrClient;
|
||||
import org.apache.solr.client.solrj.impl.HttpSolrClient;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
|
@ -44,11 +43,14 @@ import org.springframework.util.StringUtils;
|
|||
@EnableConfigurationProperties(SolrProperties.class)
|
||||
public class SolrAutoConfiguration {
|
||||
|
||||
@Autowired
|
||||
private SolrProperties properties;
|
||||
private final SolrProperties properties;
|
||||
|
||||
private SolrClient solrClient;
|
||||
|
||||
public SolrAutoConfiguration(SolrProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@PreDestroy
|
||||
public void close() throws IOException {
|
||||
if (this.solrClient != null) {
|
||||
|
|
|
@ -212,11 +212,15 @@ public class ThymeleafAutoConfiguration {
|
|||
@ConditionalOnWebApplication
|
||||
protected static class ThymeleafViewResolverConfiguration {
|
||||
|
||||
@Autowired
|
||||
private ThymeleafProperties properties;
|
||||
private final ThymeleafProperties properties;
|
||||
|
||||
@Autowired
|
||||
private SpringTemplateEngine templateEngine;
|
||||
private final SpringTemplateEngine templateEngine;
|
||||
|
||||
protected ThymeleafViewResolverConfiguration(ThymeleafProperties properties,
|
||||
SpringTemplateEngine templateEngine) {
|
||||
this.properties = properties;
|
||||
this.templateEngine = templateEngine;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(name = "thymeleafViewResolver")
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.transaction;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
|
@ -43,8 +42,11 @@ import org.springframework.transaction.support.TransactionTemplate;
|
|||
DataSourceTransactionManagerAutoConfiguration.class })
|
||||
public class TransactionAutoConfiguration {
|
||||
|
||||
@Autowired
|
||||
private PlatformTransactionManager transactionManager;
|
||||
private final PlatformTransactionManager transactionManager;
|
||||
|
||||
public TransactionAutoConfiguration(PlatformTransactionManager transactionManager) {
|
||||
this.transactionManager = transactionManager;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
|
|
|
@ -27,7 +27,6 @@ import com.atomikos.icatch.config.UserTransactionService;
|
|||
import com.atomikos.icatch.config.UserTransactionServiceImp;
|
||||
import com.atomikos.icatch.jta.UserTransactionManager;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationHome;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
|
@ -59,8 +58,11 @@ import org.springframework.util.StringUtils;
|
|||
@ConditionalOnMissingBean(PlatformTransactionManager.class)
|
||||
class AtomikosJtaConfiguration {
|
||||
|
||||
@Autowired
|
||||
private JtaProperties jtaProperties;
|
||||
private final JtaProperties jtaProperties;
|
||||
|
||||
AtomikosJtaConfiguration(JtaProperties jtaProperties) {
|
||||
this.jtaProperties = jtaProperties;
|
||||
}
|
||||
|
||||
@Bean(initMethod = "init", destroyMethod = "shutdownForce")
|
||||
@ConditionalOnMissingBean(UserTransactionService.class)
|
||||
|
|
|
@ -25,7 +25,6 @@ import bitronix.tm.BitronixTransactionManager;
|
|||
import bitronix.tm.TransactionManagerServices;
|
||||
import bitronix.tm.jndi.BitronixContext;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.ApplicationHome;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
|
@ -54,8 +53,11 @@ import org.springframework.util.StringUtils;
|
|||
@ConditionalOnMissingBean(PlatformTransactionManager.class)
|
||||
class BitronixJtaConfiguration {
|
||||
|
||||
@Autowired
|
||||
private JtaProperties jtaProperties;
|
||||
private final JtaProperties jtaProperties;
|
||||
|
||||
BitronixJtaConfiguration(JtaProperties jtaProperties) {
|
||||
this.jtaProperties = jtaProperties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -64,11 +64,15 @@ public class VelocityAutoConfiguration {
|
|||
|
||||
private static final Log logger = LogFactory.getLog(VelocityAutoConfiguration.class);
|
||||
|
||||
@Autowired
|
||||
private ApplicationContext applicationContext;
|
||||
private final ApplicationContext applicationContext;
|
||||
|
||||
@Autowired
|
||||
private VelocityProperties properties;
|
||||
private final VelocityProperties properties;
|
||||
|
||||
public VelocityAutoConfiguration(ApplicationContext applicationContext,
|
||||
VelocityProperties properties) {
|
||||
this.applicationContext = applicationContext;
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@PostConstruct
|
||||
public void checkTemplateLocationExists() {
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -27,7 +27,6 @@ import javax.servlet.http.HttpServletResponse;
|
|||
|
||||
import org.springframework.aop.framework.autoproxy.AutoProxyUtils;
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
|
||||
import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureBefore;
|
||||
|
@ -77,8 +76,11 @@ import org.springframework.web.util.HtmlUtils;
|
|||
@Configuration
|
||||
public class ErrorMvcAutoConfiguration {
|
||||
|
||||
@Autowired
|
||||
private ServerProperties properties;
|
||||
private final ServerProperties properties;
|
||||
|
||||
public ErrorMvcAutoConfiguration(ServerProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(value = ErrorAttributes.class, search = SearchStrategy.CURRENT)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2014 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.web;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
|
@ -40,8 +39,11 @@ import org.springframework.web.filter.CharacterEncodingFilter;
|
|||
@ConditionalOnProperty(prefix = "spring.http.encoding", value = "enabled", matchIfMissing = true)
|
||||
public class HttpEncodingAutoConfiguration {
|
||||
|
||||
@Autowired
|
||||
private HttpEncodingProperties httpEncodingProperties;
|
||||
private final HttpEncodingProperties httpEncodingProperties;
|
||||
|
||||
public HttpEncodingAutoConfiguration(HttpEncodingProperties httpEncodingProperties) {
|
||||
this.httpEncodingProperties = httpEncodingProperties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean(CharacterEncodingFilter.class)
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -68,8 +68,12 @@ public class HttpMessageConvertersAutoConfiguration {
|
|||
@EnableConfigurationProperties(HttpEncodingProperties.class)
|
||||
protected static class StringHttpMessageConverterConfiguration {
|
||||
|
||||
@Autowired
|
||||
private HttpEncodingProperties encodingProperties;
|
||||
private final HttpEncodingProperties encodingProperties;
|
||||
|
||||
protected StringHttpMessageConverterConfiguration(
|
||||
HttpEncodingProperties encodingProperties) {
|
||||
this.encodingProperties = encodingProperties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -19,7 +19,6 @@ package org.springframework.boot.autoconfigure.web;
|
|||
import javax.servlet.MultipartConfigElement;
|
||||
import javax.servlet.Servlet;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
|
||||
|
@ -52,8 +51,11 @@ import org.springframework.web.servlet.DispatcherServlet;
|
|||
@EnableConfigurationProperties(MultipartProperties.class)
|
||||
public class MultipartAutoConfiguration {
|
||||
|
||||
@Autowired
|
||||
private MultipartProperties multipartProperties = new MultipartProperties();
|
||||
private final MultipartProperties multipartProperties;
|
||||
|
||||
public MultipartAutoConfiguration(MultipartProperties multipartProperties) {
|
||||
this.multipartProperties = multipartProperties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
|
|
|
@ -296,8 +296,11 @@ public class WebMvcAutoConfiguration {
|
|||
@ConditionalOnProperty(value = "spring.mvc.favicon.enabled", matchIfMissing = true)
|
||||
public static class FaviconConfiguration {
|
||||
|
||||
@Autowired
|
||||
private ResourceProperties resourceProperties = new ResourceProperties();
|
||||
private final ResourceProperties resourceProperties;
|
||||
|
||||
public FaviconConfiguration(ResourceProperties resourceProperties) {
|
||||
this.resourceProperties = resourceProperties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public SimpleUrlHandlerMapping faviconHandlerMapping() {
|
||||
|
|
|
@ -20,7 +20,6 @@ import java.util.List;
|
|||
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
|
||||
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
|
||||
|
@ -58,8 +57,11 @@ public class WebSocketMessagingAutoConfiguration {
|
|||
static class WebSocketMessageConverterConfiguration
|
||||
extends AbstractWebSocketMessageBrokerConfigurer {
|
||||
|
||||
@Autowired
|
||||
private ObjectMapper objectMapper;
|
||||
private final ObjectMapper objectMapper;
|
||||
|
||||
WebSocketMessageConverterConfiguration(ObjectMapper objectMapper) {
|
||||
this.objectMapper = objectMapper;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerStompEndpoints(StompEndpointRegistry registry) {
|
||||
|
|
|
@ -36,6 +36,10 @@ import static org.mockito.Mockito.mock;
|
|||
public class CouchbaseTestConfiguration
|
||||
extends CouchbaseAutoConfiguration.CouchbaseConfiguration {
|
||||
|
||||
public CouchbaseTestConfiguration(CouchbaseProperties properties) {
|
||||
super(properties);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Cluster couchbaseCluster() throws Exception {
|
||||
return mock(CouchbaseCluster.class);
|
||||
|
|
|
@ -33,7 +33,6 @@ import org.junit.Test;
|
|||
import org.junit.rules.ExpectedException;
|
||||
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceBuilder;
|
||||
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
|
||||
|
@ -266,8 +265,11 @@ public class FlywayAutoConfigurationTests {
|
|||
@Configuration
|
||||
protected static class CustomFlywayWithJpaConfiguration {
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
private final DataSource dataSource;
|
||||
|
||||
protected CustomFlywayWithJpaConfiguration(DataSource dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Flyway flyway() {
|
||||
|
|
|
@ -30,7 +30,6 @@ import org.junit.Test;
|
|||
import org.junit.rules.ExpectedException;
|
||||
|
||||
import org.springframework.beans.factory.BeanCreationException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
@ -291,8 +290,11 @@ public abstract class AbstractJpaAutoConfigurationTests {
|
|||
@TestAutoConfigurationPackage(AbstractJpaAutoConfigurationTests.class)
|
||||
public static class TestConfigurationWithCustomPersistenceUnitManager {
|
||||
|
||||
@Autowired
|
||||
private DataSource dataSource;
|
||||
private final DataSource dataSource;
|
||||
|
||||
public TestConfigurationWithCustomPersistenceUnitManager(DataSource dataSource) {
|
||||
this.dataSource = dataSource;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PersistenceUnitManager persistenceUnitManager() {
|
||||
|
|
|
@ -32,7 +32,6 @@ import org.springframework.beans.factory.BeanCreationException;
|
|||
import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.transaction.jta.JtaAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.transaction.jta.JtaProperties;
|
||||
import org.springframework.boot.orm.jpa.hibernate.SpringJtaPlatform;
|
||||
import org.springframework.boot.test.EnvironmentTestUtils;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
|
@ -133,7 +132,7 @@ public class HibernateJpaAutoConfigurationTests
|
|||
|
||||
@Test
|
||||
public void defaultJtaPlatform() throws Exception {
|
||||
this.context.register(JtaProperties.class, JtaAutoConfiguration.class);
|
||||
this.context.register(JtaAutoConfiguration.class);
|
||||
setupTestConfiguration();
|
||||
this.context.refresh();
|
||||
Map<String, Object> jpaPropertyMap = this.context
|
||||
|
@ -148,7 +147,7 @@ public class HibernateJpaAutoConfigurationTests
|
|||
EnvironmentTestUtils.addEnvironment(this.context,
|
||||
"spring.jpa.properties.hibernate.transaction.jta.platform:"
|
||||
+ TestJtaPlatform.class.getName());
|
||||
this.context.register(JtaProperties.class, JtaAutoConfiguration.class);
|
||||
this.context.register(JtaAutoConfiguration.class);
|
||||
setupTestConfiguration();
|
||||
this.context.refresh();
|
||||
Map<String, Object> jpaPropertyMap = this.context
|
||||
|
|
|
@ -23,7 +23,6 @@ import javax.servlet.DispatcherType;
|
|||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
|
||||
import org.springframework.boot.autoconfigure.TestAutoConfigurationPackage;
|
||||
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
||||
|
@ -442,8 +441,11 @@ public class SecurityAutoConfigurationTests {
|
|||
@Configuration
|
||||
protected static class SecurityCustomizer extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
AuthenticationManager authenticationManager;
|
||||
final AuthenticationManager authenticationManager;
|
||||
|
||||
protected SecurityCustomizer(AuthenticationManager authenticationManager) {
|
||||
this.authenticationManager = authenticationManager;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
@ -451,12 +453,15 @@ public class SecurityAutoConfigurationTests {
|
|||
protected static class WorkaroundSecurityCustomizer
|
||||
extends WebSecurityConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
private AuthenticationManagerBuilder builder;
|
||||
private final AuthenticationManagerBuilder builder;
|
||||
|
||||
@SuppressWarnings("unused")
|
||||
private AuthenticationManager authenticationManager;
|
||||
|
||||
protected WorkaroundSecurityCustomizer(AuthenticationManagerBuilder builder) {
|
||||
this.builder = builder;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void configure(HttpSecurity http) throws Exception {
|
||||
this.authenticationManager = new AuthenticationManager() {
|
||||
|
|
|
@ -245,6 +245,8 @@ public class SpringBootWebSecurityConfigurationTests {
|
|||
protected static class TestInjectWebConfiguration
|
||||
extends WebSecurityConfigurerAdapter {
|
||||
|
||||
private final AuthenticationManagerBuilder auth;
|
||||
|
||||
// It's a bad idea to inject an AuthenticationManager into a
|
||||
// WebSecurityConfigurerAdapter because it can cascade early instantiation,
|
||||
// unless you explicitly want the Boot default AuthenticationManager. It's
|
||||
|
@ -252,8 +254,9 @@ public class SpringBootWebSecurityConfigurationTests {
|
|||
// might even be necessary to wrap the builder in a lazy AuthenticationManager
|
||||
// (that calls getOrBuild() only when the AuthenticationManager is actually
|
||||
// called).
|
||||
@Autowired
|
||||
private AuthenticationManagerBuilder auth;
|
||||
protected TestInjectWebConfiguration(AuthenticationManagerBuilder auth) {
|
||||
this.auth = auth;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(WebSecurity web) throws Exception {
|
||||
|
|
|
@ -469,8 +469,11 @@ public class OAuth2AutoConfigurationTests {
|
|||
@EnableResourceServer
|
||||
protected static class CustomResourceServer extends ResourceServerConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
private ResourceServerProperties config;
|
||||
private final ResourceServerProperties config;
|
||||
|
||||
protected CustomResourceServer(ResourceServerProperties config) {
|
||||
this.config = config;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void configure(ResourceServerSecurityConfigurer resources)
|
||||
|
@ -493,8 +496,11 @@ public class OAuth2AutoConfigurationTests {
|
|||
protected static class CustomAuthorizationServer
|
||||
extends AuthorizationServerConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
private AuthenticationManager authenticationManager;
|
||||
private final AuthenticationManager authenticationManager;
|
||||
|
||||
protected CustomAuthorizationServer(AuthenticationManager authenticationManager) {
|
||||
this.authenticationManager = authenticationManager;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public TokenStore tokenStore() {
|
||||
|
|
|
@ -23,7 +23,6 @@ import java.util.Map;
|
|||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanDefinition;
|
||||
import org.springframework.beans.factory.support.BeanDefinitionRegistry;
|
||||
import org.springframework.boot.autoconfigure.PropertyPlaceholderAutoConfiguration;
|
||||
|
@ -242,9 +241,12 @@ public class ResourceServerTokenServicesConfigurationTests {
|
|||
@Configuration
|
||||
protected static class ResourceServerPropertiesConfiguration {
|
||||
|
||||
@Autowired
|
||||
private OAuth2ClientProperties credentials;
|
||||
|
||||
public ResourceServerPropertiesConfiguration(OAuth2ClientProperties credentials) {
|
||||
this.credentials = credentials;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ResourceServerProperties resourceServerProperties() {
|
||||
return new ResourceServerProperties(this.credentials.getClientId(),
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package org.springframework.boot.autoconfigure.security.user;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.orm.jpa.EntityScan;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
|
||||
|
@ -30,8 +29,11 @@ import org.springframework.security.config.annotation.method.configuration.Enabl
|
|||
@EnableJpaRepositories(basePackageClasses = User.class)
|
||||
public class SecurityConfig extends GlobalAuthenticationConfigurerAdapter {
|
||||
|
||||
@Autowired
|
||||
protected UserRepository userRepository;
|
||||
protected final UserRepository userRepository;
|
||||
|
||||
public SecurityConfig(UserRepository userRepository) {
|
||||
this.userRepository = userRepository;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init(AuthenticationManagerBuilder auth) throws Exception {
|
||||
|
|
|
@ -124,8 +124,8 @@ public class WebSocketMessagingAutoConfigurationTests {
|
|||
|
||||
private List<MessageConverter> getCustomizedConverters() {
|
||||
List<MessageConverter> customizedConverters = new ArrayList<MessageConverter>();
|
||||
WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration configuration = new WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration();
|
||||
ReflectionTestUtils.setField(configuration, "objectMapper", new ObjectMapper());
|
||||
WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration configuration = new WebSocketMessagingAutoConfiguration.WebSocketMessageConverterConfiguration(
|
||||
new ObjectMapper());
|
||||
configuration.configureMessageConverters(customizedConverters);
|
||||
return customizedConverters;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -74,11 +74,15 @@ public class RemoteDevToolsAutoConfiguration {
|
|||
private static final Log logger = LogFactory
|
||||
.getLog(RemoteDevToolsAutoConfiguration.class);
|
||||
|
||||
@Autowired
|
||||
private DevToolsProperties properties;
|
||||
private final DevToolsProperties properties;
|
||||
|
||||
@Autowired
|
||||
private ServerProperties serverProperties;
|
||||
private final ServerProperties serverProperties;
|
||||
|
||||
public RemoteDevToolsAutoConfiguration(DevToolsProperties properties,
|
||||
ServerProperties serverProperties) {
|
||||
this.properties = properties;
|
||||
this.serverProperties = serverProperties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
@ConditionalOnMissingBean
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
/*
|
||||
* Copyright 2012-2015 the original author or authors.
|
||||
* Copyright 2012-2016 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.
|
||||
|
@ -80,12 +80,15 @@ public class RemoteClientConfiguration {
|
|||
|
||||
private static final Log logger = LogFactory.getLog(RemoteClientConfiguration.class);
|
||||
|
||||
@Autowired
|
||||
private DevToolsProperties properties;
|
||||
private final DevToolsProperties properties;
|
||||
|
||||
@Value("${remoteUrl}")
|
||||
private String remoteUrl;
|
||||
|
||||
public RemoteClientConfiguration(DevToolsProperties properties) {
|
||||
this.properties = properties;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public static PropertySourcesPlaceholderConfigurer propertySourcesPlaceholderConfigurer() {
|
||||
return new PropertySourcesPlaceholderConfigurer();
|
||||
|
|
|
@ -28,7 +28,6 @@ import org.junit.Test;
|
|||
import org.junit.rules.ExpectedException;
|
||||
import org.junit.rules.TemporaryFolder;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.devtools.filewatch.ChangedFile;
|
||||
import org.springframework.boot.devtools.filewatch.FileSystemWatcher;
|
||||
import org.springframework.boot.devtools.filewatch.FileSystemWatcherFactory;
|
||||
|
@ -92,8 +91,11 @@ public class ClassPathFileSystemWatcherTests {
|
|||
@Configuration
|
||||
public static class Config {
|
||||
|
||||
@Autowired
|
||||
public Environment environment;
|
||||
public final Environment environment;
|
||||
|
||||
public Config(Environment environment) {
|
||||
this.environment = environment;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public ClassPathFileSystemWatcher watcher() {
|
||||
|
|
|
@ -16,7 +16,6 @@
|
|||
|
||||
package sample.metrics.redis;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.actuate.endpoint.MetricReaderPublicMetrics;
|
||||
import org.springframework.boot.actuate.endpoint.PublicMetrics;
|
||||
import org.springframework.boot.actuate.metrics.aggregate.AggregateMetricReader;
|
||||
|
@ -30,11 +29,15 @@ import org.springframework.data.redis.connection.RedisConnectionFactory;
|
|||
@Configuration
|
||||
public class AggregateMetricsConfiguration {
|
||||
|
||||
@Autowired
|
||||
private MetricExportProperties export;
|
||||
private final MetricExportProperties export;
|
||||
|
||||
@Autowired
|
||||
private RedisConnectionFactory connectionFactory;
|
||||
private final RedisConnectionFactory connectionFactory;
|
||||
|
||||
public AggregateMetricsConfiguration(MetricExportProperties export,
|
||||
RedisConnectionFactory connectionFactory) {
|
||||
this.export = export;
|
||||
this.connectionFactory = connectionFactory;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public PublicMetrics metricsAggregate() {
|
||||
|
|
|
@ -22,7 +22,6 @@ import java.nio.charset.Charset;
|
|||
import org.junit.After;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory;
|
||||
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
|
||||
import org.springframework.boot.context.embedded.undertow.UndertowEmbeddedServletContainerFactory;
|
||||
|
@ -168,8 +167,11 @@ public class EmbeddedServletContainerMvcIntegrationTests {
|
|||
@PropertySource("classpath:/org/springframework/boot/context/embedded/conf.properties")
|
||||
public static class AdvancedConfig {
|
||||
|
||||
@Autowired
|
||||
private Environment env;
|
||||
private final Environment env;
|
||||
|
||||
public AdvancedConfig(Environment env) {
|
||||
this.env = env;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public EmbeddedServletContainerFactory containerFactory() {
|
||||
|
|
|
@ -24,7 +24,6 @@ import org.junit.Test;
|
|||
import org.junit.rules.ExpectedException;
|
||||
|
||||
import org.springframework.beans.BeansException;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.config.BeanPostProcessor;
|
||||
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
|
@ -170,8 +169,11 @@ public class EntityScanTests {
|
|||
@EntityScan("com.mycorp.entity")
|
||||
static class BeanPostProcessorConfiguration {
|
||||
|
||||
@Autowired
|
||||
protected EntityManagerFactory entityManagerFactory;
|
||||
protected final EntityManagerFactory entityManagerFactory;
|
||||
|
||||
BeanPostProcessorConfiguration(EntityManagerFactory entityManagerFactory) {
|
||||
this.entityManagerFactory = entityManagerFactory;
|
||||
}
|
||||
|
||||
@Bean
|
||||
public BeanPostProcessor beanPostProcessor() {
|
||||
|
|
Loading…
Reference in New Issue