pull/1284/merge
Phillip Webb 10 years ago
parent 81cd11b4ec
commit 6825a7b42e

@ -30,7 +30,6 @@ public class BatchProperties {
private static final String DEFAULT_SCHEMA_LOCATION = "classpath:org/springframework/"
+ "batch/core/schema-@@platform@@.sql";
private String schema = DEFAULT_SCHEMA_LOCATION;
private final Initializer initializer = new Initializer();
@ -38,7 +37,7 @@ public class BatchProperties {
private final Job job = new Job();
public String getSchema() {
return schema;
return this.schema;
}
public void setSchema(String schema) {
@ -46,11 +45,11 @@ public class BatchProperties {
}
public Initializer getInitializer() {
return initializer;
return this.initializer;
}
public Job getJob() {
return job;
return this.job;
}
public static class Initializer {
@ -58,12 +57,13 @@ public class BatchProperties {
private boolean enabled = true;
public boolean isEnabled() {
return enabled;
return this.enabled;
}
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}
}
public static class Job {
@ -71,11 +71,12 @@ public class BatchProperties {
private String names = "";
public String getNames() {
return names;
return this.names;
}
public void setNames(String names) {
this.names = names;
}
}
}

@ -64,7 +64,12 @@ public class DeviceDelegatingViewResolverAutoConfiguration {
ViewResolver delegate, int delegateOrder) {
LiteDeviceDelegatingViewResolver resolver = new LiteDeviceDelegatingViewResolver(
delegate);
viewResolverProperties.apply(resolver);
resolver.setNormalPrefix(this.viewResolverProperties.getNormalPrefix());
resolver.setNormalSuffix(this.viewResolverProperties.getNormalSuffix());
resolver.setMobilePrefix(this.viewResolverProperties.getMobilePrefix());
resolver.setMobileSuffix(this.viewResolverProperties.getMobileSuffix());
resolver.setTabletPrefix(this.viewResolverProperties.getTabletPrefix());
resolver.setTabletSuffix(this.viewResolverProperties.getTabletSuffix());
resolver.setOrder(getAdjustedOrder(delegateOrder));
return resolver;
}
@ -83,8 +88,7 @@ public class DeviceDelegatingViewResolverAutoConfiguration {
@Configuration
@EnableConfigurationProperties(DeviceDelegatingViewResolverProperties.class)
@ConditionalOnMissingBean(name = "deviceDelegatingViewResolver")
@ConditionalOnProperty(value = "spring.mobile.devicedelegatingviewresolver.enabled",
match = "true", defaultMatch = false)
@ConditionalOnProperty(value = "spring.mobile.devicedelegatingviewresolver.enabled", match = "true", defaultMatch = false)
protected static class DeviceDelegatingViewResolverConfiguration {
@Configuration

@ -17,10 +17,9 @@
package org.springframework.boot.autoconfigure.mobile;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.mobile.device.view.LiteDeviceDelegatingViewResolver;
/**
* {@link ConfigurationProperties properties} for device view resolver.
* Properties for device view resolver.
*
* @author Stephane Nicoll
* @since 1.2.0
@ -41,7 +40,7 @@ public class DeviceDelegatingViewResolverProperties {
private String tabletSuffix = "";
public String getNormalPrefix() {
return normalPrefix;
return this.normalPrefix;
}
public void setNormalPrefix(String normalPrefix) {
@ -49,7 +48,7 @@ public class DeviceDelegatingViewResolverProperties {
}
public String getNormalSuffix() {
return normalSuffix;
return this.normalSuffix;
}
public void setNormalSuffix(String normalSuffix) {
@ -57,7 +56,7 @@ public class DeviceDelegatingViewResolverProperties {
}
public String getMobilePrefix() {
return mobilePrefix;
return this.mobilePrefix;
}
public void setMobilePrefix(String mobilePrefix) {
@ -65,7 +64,7 @@ public class DeviceDelegatingViewResolverProperties {
}
public String getMobileSuffix() {
return mobileSuffix;
return this.mobileSuffix;
}
public void setMobileSuffix(String mobileSuffix) {
@ -73,7 +72,7 @@ public class DeviceDelegatingViewResolverProperties {
}
public String getTabletPrefix() {
return tabletPrefix;
return this.tabletPrefix;
}
public void setTabletPrefix(String tabletPrefix) {
@ -81,20 +80,11 @@ public class DeviceDelegatingViewResolverProperties {
}
public String getTabletSuffix() {
return tabletSuffix;
return this.tabletSuffix;
}
public void setTabletSuffix(String tabletSuffix) {
this.tabletSuffix = tabletSuffix;
}
public void apply(LiteDeviceDelegatingViewResolver resolver) {
resolver.setNormalPrefix(getNormalPrefix());
resolver.setNormalSuffix(getNormalSuffix());
resolver.setMobilePrefix(getMobilePrefix());
resolver.setMobileSuffix(getMobileSuffix());
resolver.setTabletPrefix(getTabletPrefix());
resolver.setTabletSuffix(getTabletSuffix());
}
}

@ -25,7 +25,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -64,12 +63,7 @@ public class FacebookAutoConfiguration {
SocialAutoConfigurerAdapter {
@Autowired
private FacebookProperties facebookProperties;
@Override
protected SocialProperties getSocialProperties() {
return facebookProperties;
}
private FacebookProperties properties;
@Bean
@ConditionalOnMissingBean(Facebook.class)
@ -86,14 +80,10 @@ public class FacebookAutoConfiguration {
return new GenericConnectionStatusView("facebook", "Facebook");
}
}
@ConfigurationProperties("spring.social.facebook")
public static class FacebookProperties extends SocialProperties {
public ConnectionFactory<?> createConnectionFactory() {
return new FacebookConnectionFactory(
getAppId(), getAppSecret());
@Override
protected ConnectionFactory<?> createConnectionFactory() {
return new FacebookConnectionFactory(this.properties.getAppId(),
this.properties.getAppSecret());
}
}

@ -0,0 +1,30 @@
/*
* Copyright 2012-2014 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.social;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Properties for Spring Social Facebook.
*
* @author Stephane Nicoll
* @since 1.2.0
*/
@ConfigurationProperties("spring.social.facebook")
public class FacebookProperties extends SocialProperties {
}

@ -25,7 +25,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -63,12 +62,7 @@ public class LinkedInAutoConfiguration {
SocialAutoConfigurerAdapter {
@Autowired
private LinkedInProperties linkedInProperties;
@Override
protected SocialProperties getSocialProperties() {
return linkedInProperties;
}
private LinkedInProperties properties;
@Bean
@ConditionalOnMissingBean(LinkedIn.class)
@ -85,16 +79,11 @@ public class LinkedInAutoConfiguration {
return new GenericConnectionStatusView("linkedin", "LinkedIn");
}
@Override
protected ConnectionFactory<?> createConnectionFactory() {
return new LinkedInConnectionFactory(this.properties.getAppId(),
this.properties.getAppSecret());
}
@ConfigurationProperties("spring.social.linkedin")
public static class LinkedInProperties extends SocialProperties {
public ConnectionFactory<?> createConnectionFactory() {
return new LinkedInConnectionFactory(
getAppId(), getAppSecret());
}
}
}

@ -0,0 +1,30 @@
/*
* Copyright 2012-2014 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.social;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Properties for Spring Social LinkedIn.
*
* @author Stephane Nicoll
* @since 1.2.0
*/
@ConfigurationProperties("spring.social.linkedin")
public class LinkedInProperties extends SocialProperties {
}

@ -19,6 +19,7 @@ package org.springframework.boot.autoconfigure.social;
import org.springframework.core.env.Environment;
import org.springframework.social.config.annotation.ConnectionFactoryConfigurer;
import org.springframework.social.config.annotation.SocialConfigurerAdapter;
import org.springframework.social.connect.ConnectionFactory;
/**
* Base class for auto-configured {@link SocialConfigurerAdapter}s.
@ -29,12 +30,12 @@ import org.springframework.social.config.annotation.SocialConfigurerAdapter;
*/
abstract class SocialAutoConfigurerAdapter extends SocialConfigurerAdapter {
protected abstract SocialProperties getSocialProperties();
@Override
public void addConnectionFactories(ConnectionFactoryConfigurer configurer,
Environment environment) {
configurer.addConnectionFactory(getSocialProperties().createConnectionFactory());
configurer.addConnectionFactory(createConnectionFactory());
}
protected abstract ConnectionFactory<?> createConnectionFactory();
}

@ -17,7 +17,6 @@
package org.springframework.boot.autoconfigure.social;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.social.connect.ConnectionFactory;
/**
* Base {@link ConfigurationProperties properties} for spring social.
@ -32,7 +31,7 @@ abstract class SocialProperties {
private String appSecret;
public String getAppId() {
return appId;
return this.appId;
}
public void setAppId(String appId) {
@ -40,12 +39,11 @@ abstract class SocialProperties {
}
public String getAppSecret() {
return appSecret;
return this.appSecret;
}
public void setAppSecret(String appSecret) {
this.appSecret = appSecret;
}
public abstract ConnectionFactory<?> createConnectionFactory();
}

@ -25,7 +25,6 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -64,12 +63,7 @@ public class TwitterAutoConfiguration {
SocialAutoConfigurerAdapter {
@Autowired
private TwitterProperties twitterProperties;
@Override
protected SocialProperties getSocialProperties() {
return twitterProperties;
}
private TwitterProperties properties;
@Bean
@ConditionalOnMissingBean
@ -80,7 +74,8 @@ public class TwitterAutoConfiguration {
if (connection != null) {
return connection.getApi();
}
return new TwitterTemplate(twitterProperties.getAppId(), twitterProperties.getAppSecret());
return new TwitterTemplate(this.properties.getAppId(),
this.properties.getAppSecret());
}
@Bean(name = { "connect/twitterConnect", "connect/twitterConnected" })
@ -89,14 +84,10 @@ public class TwitterAutoConfiguration {
return new GenericConnectionStatusView("twitter", "Twitter");
}
}
@ConfigurationProperties("spring.social.twitter")
public static class TwitterProperties extends SocialProperties {
public ConnectionFactory<?> createConnectionFactory() {
return new TwitterConnectionFactory(
getAppId(), getAppSecret());
@Override
protected ConnectionFactory<?> createConnectionFactory() {
return new TwitterConnectionFactory(this.properties.getAppId(),
this.properties.getAppSecret());
}
}

@ -0,0 +1,30 @@
/*
* Copyright 2012-2014 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.social;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Properties for Spring Social Twitter.
*
* @author Stephane Nicoll
* @since 1.2.0
*/
@ConfigurationProperties("spring.social.twitter")
public class TwitterProperties extends SocialProperties {
}

@ -30,7 +30,6 @@ import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
@ -57,15 +56,11 @@ import com.github.mxab.thymeleaf.extras.dataattribute.dialect.DataAttributeDiale
* @author Stephane Nicoll
*/
@Configuration
@EnableConfigurationProperties(ThymeleafAutoConfiguration.ThymeleafProperties.class)
@EnableConfigurationProperties(ThymeleafProperties.class)
@ConditionalOnClass(SpringTemplateEngine.class)
@AutoConfigureAfter(WebMvcAutoConfiguration.class)
public class ThymeleafAutoConfiguration {
public static final String DEFAULT_PREFIX = "classpath:/templates/";
public static final String DEFAULT_SUFFIX = ".html";
@Configuration
@ConditionalOnMissingBean(name = "defaultTemplateResolver")
public static class DefaultTemplateResolverConfiguration {
@ -106,100 +101,6 @@ public class ThymeleafAutoConfiguration {
}
}
@ConfigurationProperties("spring.thymeleaf")
public static class ThymeleafProperties {
private boolean checkTemplateLocation = true;
private String prefix = DEFAULT_PREFIX;
private String suffix = DEFAULT_SUFFIX;
private String mode = "HTML5";
private String encoding = "UTF-8";
private String contentType = "text/html";
private boolean cache = true;
private String[] viewNames;
private String[] excludedViewNames;
public boolean isCheckTemplateLocation() {
return this.checkTemplateLocation;
}
public void setCheckTemplateLocation(boolean checkTemplateLocation) {
this.checkTemplateLocation = checkTemplateLocation;
}
public String getPrefix() {
return this.prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public String getSuffix() {
return this.suffix;
}
public void setSuffix(String suffix) {
this.suffix = suffix;
}
public String getMode() {
return this.mode;
}
public void setMode(String mode) {
this.mode = mode;
}
public String getEncoding() {
return this.encoding;
}
public void setEncoding(String encoding) {
this.encoding = encoding;
}
public String getContentType() {
return this.contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public boolean isCache() {
return this.cache;
}
public void setCache(boolean cache) {
this.cache = cache;
}
public String[] getExcludedViewNames() {
return this.excludedViewNames;
}
public void setExcludedViewNames(String[] excludedViewNames) {
this.excludedViewNames = excludedViewNames;
}
public String[] getViewNames() {
return this.viewNames;
}
public void setViewNames(String[] viewNames) {
this.viewNames = viewNames;
}
}
@Configuration
@ConditionalOnMissingBean(SpringTemplateEngine.class)
protected static class ThymeleafDefaultConfiguration {

@ -0,0 +1,124 @@
/*
* Copyright 2012-2014 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.springframework.boot.autoconfigure.thymeleaf;
import org.springframework.boot.context.properties.ConfigurationProperties;
/**
* Properties for Thymeleaf.
*
* @author Stephane Nicoll
* @since 1.2.0
*/
@ConfigurationProperties("spring.thymeleaf")
public class ThymeleafProperties {
public static final String DEFAULT_PREFIX = "classpath:/templates/";
public static final String DEFAULT_SUFFIX = ".html";
private boolean checkTemplateLocation = true;
private String prefix = DEFAULT_PREFIX;
private String suffix = DEFAULT_SUFFIX;
private String mode = "HTML5";
private String encoding = "UTF-8";
private String contentType = "text/html";
private boolean cache = true;
private String[] viewNames;
private String[] excludedViewNames;
public boolean isCheckTemplateLocation() {
return this.checkTemplateLocation;
}
public void setCheckTemplateLocation(boolean checkTemplateLocation) {
this.checkTemplateLocation = checkTemplateLocation;
}
public String getPrefix() {
return this.prefix;
}
public void setPrefix(String prefix) {
this.prefix = prefix;
}
public String getSuffix() {
return this.suffix;
}
public void setSuffix(String suffix) {
this.suffix = suffix;
}
public String getMode() {
return this.mode;
}
public void setMode(String mode) {
this.mode = mode;
}
public String getEncoding() {
return this.encoding;
}
public void setEncoding(String encoding) {
this.encoding = encoding;
}
public String getContentType() {
return this.contentType;
}
public void setContentType(String contentType) {
this.contentType = contentType;
}
public boolean isCache() {
return this.cache;
}
public void setCache(boolean cache) {
this.cache = cache;
}
public String[] getExcludedViewNames() {
return this.excludedViewNames;
}
public void setExcludedViewNames(String[] excludedViewNames) {
this.excludedViewNames = excludedViewNames;
}
public String[] getViewNames() {
return this.viewNames;
}
public void setViewNames(String[] viewNames) {
this.viewNames = viewNames;
}
}

@ -37,9 +37,9 @@ public class ThymeleafTemplateAvailabilityProvider implements
if (ClassUtils.isPresent("org.thymeleaf.spring4.SpringTemplateEngine",
classLoader)) {
String prefix = environment.getProperty("spring.thymeleaf.prefix",
ThymeleafAutoConfiguration.DEFAULT_PREFIX);
ThymeleafProperties.DEFAULT_PREFIX);
String suffix = environment.getProperty("spring.thymeleaf.suffix",
ThymeleafAutoConfiguration.DEFAULT_SUFFIX);
ThymeleafProperties.DEFAULT_SUFFIX);
return resourceLoader.getResource(prefix + view + suffix).exists();
}

Loading…
Cancel
Save