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