diff --git a/spring-boot-project/spring-boot-autoconfigure/pom.xml b/spring-boot-project/spring-boot-autoconfigure/pom.xml index 5cdbaef814..c696efa1e6 100755 --- a/spring-boot-project/spring-boot-autoconfigure/pom.xml +++ b/spring-boot-project/spring-boot-autoconfigure/pom.xml @@ -573,11 +573,6 @@ spring-cloud-spring-service-connector true - - org.springframework.mobile - spring-mobile-device - true - org.springframework.social spring-social-config diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration.java deleted file mode 100644 index 809095d562..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfiguration.java +++ /dev/null @@ -1,143 +0,0 @@ -/* - * Copyright 2012-2017 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.mobile; - -import org.thymeleaf.spring5.view.ThymeleafViewResolver; - -import org.springframework.boot.autoconfigure.AutoConfigureAfter; -import org.springframework.boot.autoconfigure.EnableAutoConfiguration; -import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type; -import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration; -import org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration; -import org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration; -import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration; -import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration; -import org.springframework.boot.context.properties.EnableConfigurationProperties; -import org.springframework.boot.web.servlet.view.MustacheViewResolver; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.mobile.device.view.LiteDeviceDelegatingViewResolver; -import org.springframework.web.servlet.view.InternalResourceViewResolver; -import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver; -import org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for Spring Mobile's - * {@link LiteDeviceDelegatingViewResolver}. If {@link ThymeleafViewResolver} is available - * it is configured as the delegate view resolver. Otherwise, - * {@link InternalResourceViewResolver} is used as a fallback. - * - * @author Roy Clarkson - * @author Stephane Nicoll - * @since 1.1.0 - */ -@Configuration -@ConditionalOnWebApplication(type = Type.SERVLET) -@ConditionalOnClass(LiteDeviceDelegatingViewResolver.class) -@ConditionalOnProperty(prefix = "spring.mobile.devicedelegatingviewresolver", name = "enabled", havingValue = "true") -@EnableConfigurationProperties(DeviceDelegatingViewResolverProperties.class) -@AutoConfigureAfter({ WebMvcAutoConfiguration.class, FreeMarkerAutoConfiguration.class, - GroovyTemplateAutoConfiguration.class, MustacheAutoConfiguration.class, - ThymeleafAutoConfiguration.class }) -public class DeviceDelegatingViewResolverAutoConfiguration { - - @Configuration - protected static class LiteDeviceDelegatingViewResolverFactoryConfiguration { - - @Bean - public DeviceDelegatingViewResolverFactory deviceDelegatingViewResolverFactory( - DeviceDelegatingViewResolverProperties properties) { - return new DeviceDelegatingViewResolverFactory(properties); - } - - } - - @Configuration - @ConditionalOnClass(FreeMarkerViewResolver.class) - protected static class DeviceDelegatingFreeMarkerViewResolverConfiguration { - - @Bean - @ConditionalOnBean(FreeMarkerViewResolver.class) - public LiteDeviceDelegatingViewResolver deviceDelegatingFreeMarkerViewResolver( - DeviceDelegatingViewResolverFactory factory, - FreeMarkerViewResolver viewResolver) { - return factory.createViewResolver(viewResolver); - } - - } - - @Configuration - @ConditionalOnClass(GroovyMarkupViewResolver.class) - protected static class DeviceDelegatingGroovyMarkupViewResolverConfiguration { - - @Bean - @ConditionalOnBean(GroovyMarkupViewResolver.class) - public LiteDeviceDelegatingViewResolver deviceDelegatingGroovyMarkupViewResolver( - DeviceDelegatingViewResolverFactory factory, - GroovyMarkupViewResolver viewResolver) { - return factory.createViewResolver(viewResolver); - } - - } - - @Configuration - @ConditionalOnClass(InternalResourceViewResolver.class) - protected static class DeviceDelegatingJspViewResolverConfiguration { - - @Bean - @ConditionalOnBean(InternalResourceViewResolver.class) - public LiteDeviceDelegatingViewResolver deviceDelegatingJspViewResolver( - DeviceDelegatingViewResolverFactory factory, - InternalResourceViewResolver viewResolver) { - return factory.createViewResolver(viewResolver); - } - - } - - @Configuration - @ConditionalOnClass(MustacheViewResolver.class) - protected static class DeviceDelegatingMustacheViewResolverConfiguration { - - @Bean - @ConditionalOnBean(MustacheViewResolver.class) - public LiteDeviceDelegatingViewResolver deviceDelegatingMustacheViewResolver( - DeviceDelegatingViewResolverFactory factory, - MustacheViewResolver viewResolver) { - return factory.createViewResolver(viewResolver); - } - - } - - @Configuration - @ConditionalOnClass(ThymeleafViewResolver.class) - protected static class DeviceDelegatingThymeleafViewResolverConfiguration { - - @Bean - @ConditionalOnBean(ThymeleafViewResolver.class) - public LiteDeviceDelegatingViewResolver deviceDelegatingThymeleafViewResolver( - DeviceDelegatingViewResolverFactory factory, - ThymeleafViewResolver viewResolver) { - return factory.createViewResolver(viewResolver); - } - - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverFactory.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverFactory.java deleted file mode 100644 index 9b105c096f..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverFactory.java +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright 2012-2017 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.mobile; - -import org.springframework.core.Ordered; -import org.springframework.mobile.device.view.LiteDeviceDelegatingViewResolver; -import org.springframework.web.servlet.ViewResolver; - -/** - * A factory for {@link LiteDeviceDelegatingViewResolver} that applies customizations of - * {@link DeviceDelegatingViewResolverProperties}. - * - * @author Stephane Nicoll - * @since 1.4.0 - */ -public class DeviceDelegatingViewResolverFactory { - - private final DeviceDelegatingViewResolverProperties properties; - - public DeviceDelegatingViewResolverFactory( - DeviceDelegatingViewResolverProperties properties) { - this.properties = properties; - } - - /** - * Create a {@link LiteDeviceDelegatingViewResolver} delegating to the specified - * {@link ViewResolver}. - * @param delegate the view resolver to delegate to - * @param delegatingOrder the order of the {@link LiteDeviceDelegatingViewResolver} - * @return a {@link LiteDeviceDelegatingViewResolver} handling the specified resolver - */ - public LiteDeviceDelegatingViewResolver createViewResolver(ViewResolver delegate, - int delegatingOrder) { - LiteDeviceDelegatingViewResolver resolver = new LiteDeviceDelegatingViewResolver( - delegate); - resolver.setEnableFallback(this.properties.isEnableFallback()); - resolver.setNormalPrefix(this.properties.getNormalPrefix()); - resolver.setNormalSuffix(this.properties.getNormalSuffix()); - resolver.setMobilePrefix(this.properties.getMobilePrefix()); - resolver.setMobileSuffix(this.properties.getMobileSuffix()); - resolver.setTabletPrefix(this.properties.getTabletPrefix()); - resolver.setTabletSuffix(this.properties.getTabletSuffix()); - resolver.setOrder(delegatingOrder); - return resolver; - } - - /** - * Create a {@link LiteDeviceDelegatingViewResolver} delegating to the specified - * {@link ViewResolver} and computing a sensible order for it. The specified - * {@link ViewResolver} should implement {@link Ordered}, consider using - * {@link #createViewResolver(ViewResolver, int)} if that's not the case. - * @param delegate the view resolver to delegate to - * @return a {@link LiteDeviceDelegatingViewResolver} handling the specified resolver - */ - public LiteDeviceDelegatingViewResolver createViewResolver(ViewResolver delegate) { - if (!(delegate instanceof Ordered)) { - throw new IllegalStateException("ViewResolver " + delegate - + " should implement " + Ordered.class.getName()); - } - int delegateOrder = ((Ordered) delegate).getOrder(); - return createViewResolver(delegate, adjustOrder(delegateOrder)); - } - - private int adjustOrder(int order) { - if (order == Ordered.HIGHEST_PRECEDENCE) { - return Ordered.HIGHEST_PRECEDENCE; - } - // The view resolver must be ordered higher than the delegate view - // resolver, otherwise the view names will not be adjusted - return order - 1; - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverProperties.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverProperties.java deleted file mode 100644 index 8b1fbbcf91..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverProperties.java +++ /dev/null @@ -1,121 +0,0 @@ -/* - * Copyright 2012-2017 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.mobile; - -import org.springframework.boot.context.properties.ConfigurationProperties; - -/** - * Properties for device view resolver. - * - * @author Stephane Nicoll - * @since 1.2.0 - */ -@ConfigurationProperties(prefix = "spring.mobile.devicedelegatingviewresolver") -public class DeviceDelegatingViewResolverProperties { - - /** - * Enable support for fallback resolution. - */ - private boolean enableFallback; - - /** - * Prefix that gets prepended to view names for normal devices. - */ - private String normalPrefix = ""; - - /** - * Suffix that gets appended to view names for normal devices. - */ - private String normalSuffix = ""; - - /** - * Prefix that gets prepended to view names for mobile devices. - */ - private String mobilePrefix = "mobile/"; - - /** - * Suffix that gets appended to view names for mobile devices. - */ - private String mobileSuffix = ""; - - /** - * Prefix that gets prepended to view names for tablet devices. - */ - private String tabletPrefix = "tablet/"; - - /** - * Suffix that gets appended to view names for tablet devices. - */ - private String tabletSuffix = ""; - - public void setEnableFallback(boolean enableFallback) { - this.enableFallback = enableFallback; - } - - public boolean isEnableFallback() { - return this.enableFallback; - } - - public String getNormalPrefix() { - return this.normalPrefix; - } - - public void setNormalPrefix(String normalPrefix) { - this.normalPrefix = normalPrefix; - } - - public String getNormalSuffix() { - return this.normalSuffix; - } - - public void setNormalSuffix(String normalSuffix) { - this.normalSuffix = normalSuffix; - } - - public String getMobilePrefix() { - return this.mobilePrefix; - } - - public void setMobilePrefix(String mobilePrefix) { - this.mobilePrefix = mobilePrefix; - } - - public String getMobileSuffix() { - return this.mobileSuffix; - } - - public void setMobileSuffix(String mobileSuffix) { - this.mobileSuffix = mobileSuffix; - } - - public String getTabletPrefix() { - return this.tabletPrefix; - } - - public void setTabletPrefix(String tabletPrefix) { - this.tabletPrefix = tabletPrefix; - } - - public String getTabletSuffix() { - return this.tabletSuffix; - } - - public void setTabletSuffix(String tabletSuffix) { - this.tabletSuffix = tabletSuffix; - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfiguration.java deleted file mode 100644 index b083fbd13f..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfiguration.java +++ /dev/null @@ -1,90 +0,0 @@ -/* - * Copyright 2012-2017 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.mobile; - -import java.util.List; - -import org.springframework.boot.autoconfigure.AutoConfigureAfter; -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.condition.ConditionalOnWebApplication; -import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type; -import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.core.annotation.Order; -import org.springframework.mobile.device.DeviceHandlerMethodArgumentResolver; -import org.springframework.mobile.device.DeviceResolver; -import org.springframework.mobile.device.DeviceResolverHandlerInterceptor; -import org.springframework.web.method.support.HandlerMethodArgumentResolver; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for Spring Mobile's - * {@link DeviceResolver}. - * - * @author Roy Clarkson - */ -@Configuration -@ConditionalOnClass({ DeviceResolverHandlerInterceptor.class, - DeviceHandlerMethodArgumentResolver.class }) -@AutoConfigureAfter(WebMvcAutoConfiguration.class) -@ConditionalOnWebApplication(type = Type.SERVLET) -public class DeviceResolverAutoConfiguration { - - @Bean - @ConditionalOnMissingBean(DeviceResolverHandlerInterceptor.class) - public DeviceResolverHandlerInterceptor deviceResolverHandlerInterceptor() { - return new DeviceResolverHandlerInterceptor(); - } - - @Bean - public DeviceHandlerMethodArgumentResolver deviceHandlerMethodArgumentResolver() { - return new DeviceHandlerMethodArgumentResolver(); - } - - @Configuration - @Order(0) - protected static class DeviceResolverMvcConfiguration implements WebMvcConfigurer { - - private DeviceResolverHandlerInterceptor deviceResolverHandlerInterceptor; - - private DeviceHandlerMethodArgumentResolver deviceHandlerMethodArgumentResolver; - - protected DeviceResolverMvcConfiguration( - DeviceResolverHandlerInterceptor deviceResolverHandlerInterceptor, - DeviceHandlerMethodArgumentResolver deviceHandlerMethodArgumentResolver) { - this.deviceResolverHandlerInterceptor = deviceResolverHandlerInterceptor; - this.deviceHandlerMethodArgumentResolver = deviceHandlerMethodArgumentResolver; - } - - @Override - public void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(this.deviceResolverHandlerInterceptor); - } - - @Override - public void addArgumentResolvers( - List argumentResolvers) { - argumentResolvers.add(this.deviceHandlerMethodArgumentResolver); - } - - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.java deleted file mode 100644 index af3640969d..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfiguration.java +++ /dev/null @@ -1,92 +0,0 @@ -/* - * Copyright 2012-2017 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.mobile; - -import java.util.List; - -import org.springframework.boot.autoconfigure.AutoConfigureAfter; -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.condition.ConditionalOnProperty; -import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.mobile.device.DeviceResolver; -import org.springframework.mobile.device.site.SitePreferenceHandler; -import org.springframework.mobile.device.site.SitePreferenceHandlerInterceptor; -import org.springframework.mobile.device.site.SitePreferenceHandlerMethodArgumentResolver; -import org.springframework.web.method.support.HandlerMethodArgumentResolver; -import org.springframework.web.servlet.config.annotation.InterceptorRegistry; -import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; - -/** - * {@link EnableAutoConfiguration Auto-configuration} for Spring Mobile's - * {@link SitePreferenceHandler}. The site preference feature depends on a - * {@link DeviceResolver} first being registered. - * - * @author Roy Clarkson - * @since 1.1.0 - */ -@Configuration -@ConditionalOnClass({ SitePreferenceHandlerInterceptor.class, - SitePreferenceHandlerMethodArgumentResolver.class }) -@AutoConfigureAfter(DeviceResolverAutoConfiguration.class) -@ConditionalOnProperty(prefix = "spring.mobile.sitepreference", name = "enabled", havingValue = "true", matchIfMissing = true) -@ConditionalOnWebApplication(type = Type.SERVLET) -public class SitePreferenceAutoConfiguration { - - @Bean - @ConditionalOnMissingBean(SitePreferenceHandlerInterceptor.class) - public SitePreferenceHandlerInterceptor sitePreferenceHandlerInterceptor() { - return new SitePreferenceHandlerInterceptor(); - } - - @Bean - public SitePreferenceHandlerMethodArgumentResolver sitePreferenceHandlerMethodArgumentResolver() { - return new SitePreferenceHandlerMethodArgumentResolver(); - } - - @Configuration - protected static class SitePreferenceMvcConfiguration implements WebMvcConfigurer { - - private final SitePreferenceHandlerInterceptor sitePreferenceHandlerInterceptor; - - private final SitePreferenceHandlerMethodArgumentResolver sitePreferenceHandlerMethodArgumentResolver; - - protected SitePreferenceMvcConfiguration( - SitePreferenceHandlerInterceptor sitePreferenceHandlerInterceptor, - org.springframework.mobile.device.site.SitePreferenceHandlerMethodArgumentResolver sitePreferenceHandlerMethodArgumentResolver) { - this.sitePreferenceHandlerInterceptor = sitePreferenceHandlerInterceptor; - this.sitePreferenceHandlerMethodArgumentResolver = sitePreferenceHandlerMethodArgumentResolver; - } - - @Override - public void addInterceptors(InterceptorRegistry registry) { - registry.addInterceptor(this.sitePreferenceHandlerInterceptor); - } - - @Override - public void addArgumentResolvers( - List argumentResolvers) { - argumentResolvers.add(this.sitePreferenceHandlerMethodArgumentResolver); - } - - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/package-info.java b/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/package-info.java deleted file mode 100644 index a3437d1c4f..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/mobile/package-info.java +++ /dev/null @@ -1,20 +0,0 @@ -/* - * Copyright 2012-2017 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. - */ - -/** - * Auto-configuration for Spring Mobile. - */ -package org.springframework.boot.autoconfigure.mobile; diff --git a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories index d33686187a..1675ecbc67 100644 --- a/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories +++ b/spring-boot-project/spring-boot-autoconfigure/src/main/resources/META-INF/spring.factories @@ -87,9 +87,6 @@ org.springframework.boot.autoconfigure.ldap.LdapAutoConfiguration,\ org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration,\ org.springframework.boot.autoconfigure.mail.MailSenderAutoConfiguration,\ org.springframework.boot.autoconfigure.mail.MailSenderValidatorAutoConfiguration,\ -org.springframework.boot.autoconfigure.mobile.DeviceResolverAutoConfiguration,\ -org.springframework.boot.autoconfigure.mobile.DeviceDelegatingViewResolverAutoConfiguration,\ -org.springframework.boot.autoconfigure.mobile.SitePreferenceAutoConfiguration,\ org.springframework.boot.autoconfigure.mongo.embedded.EmbeddedMongoAutoConfiguration,\ org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration,\ org.springframework.boot.autoconfigure.mongo.MongoReactiveAutoConfiguration,\ diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfigurationTests.java deleted file mode 100644 index 729c95b864..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceDelegatingViewResolverAutoConfigurationTests.java +++ /dev/null @@ -1,253 +0,0 @@ -/* - * Copyright 2012-2017 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.mobile; - -import java.util.Arrays; -import java.util.Collections; -import java.util.List; - -import org.junit.After; -import org.junit.Rule; -import org.junit.Test; -import org.junit.rules.ExpectedException; -import org.thymeleaf.spring5.view.ThymeleafViewResolver; - -import org.springframework.beans.DirectFieldAccessor; -import org.springframework.beans.PropertyAccessor; -import org.springframework.beans.factory.NoSuchBeanDefinitionException; -import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration; -import org.springframework.boot.autoconfigure.freemarker.FreeMarkerAutoConfiguration; -import org.springframework.boot.autoconfigure.groovy.template.GroovyTemplateAutoConfiguration; -import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration; -import org.springframework.boot.autoconfigure.mustache.MustacheAutoConfiguration; -import org.springframework.boot.autoconfigure.thymeleaf.ThymeleafAutoConfiguration; -import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration; -import org.springframework.boot.test.util.TestPropertyValues; -import org.springframework.boot.web.servlet.view.MustacheViewResolver; -import org.springframework.core.Ordered; -import org.springframework.mobile.device.view.LiteDeviceDelegatingViewResolver; -import org.springframework.mock.web.MockServletContext; -import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; -import org.springframework.web.servlet.ViewResolver; -import org.springframework.web.servlet.view.InternalResourceViewResolver; -import org.springframework.web.servlet.view.freemarker.FreeMarkerViewResolver; -import org.springframework.web.servlet.view.groovy.GroovyMarkupViewResolver; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Tests for {@link DeviceDelegatingViewResolverAutoConfiguration}. - * - * @author Roy Clarkson - * @author Stephane Nicoll - */ -public class DeviceDelegatingViewResolverAutoConfigurationTests { - - @Rule - public final ExpectedException thrown = ExpectedException.none(); - - private AnnotationConfigWebApplicationContext context; - - @After - public void close() { - if (this.context != null) { - this.context.close(); - } - } - - @Test - public void deviceDelegatingViewResolverDefaultDisabled() throws Exception { - load(); - this.thrown.expect(NoSuchBeanDefinitionException.class); - this.context.getBean(LiteDeviceDelegatingViewResolver.class); - } - - @Test - public void deviceDelegatingJspResourceViewResolver() throws Exception { - load("spring.mobile.devicedelegatingviewresolver.enabled:true"); - assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class)) - .hasSize(1); - InternalResourceViewResolver internalResourceViewResolver = this.context - .getBean(InternalResourceViewResolver.class); - assertLiteDeviceDelegatingViewResolver(internalResourceViewResolver, - "deviceDelegatingJspViewResolver"); - } - - @Test - public void deviceDelegatingFreeMarkerViewResolver() throws Exception { - load(Collections.singletonList(FreeMarkerAutoConfiguration.class), - "spring.mobile.devicedelegatingviewresolver.enabled:true"); - assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class)) - .hasSize(2); - assertLiteDeviceDelegatingViewResolver( - this.context.getBean(FreeMarkerViewResolver.class), - "deviceDelegatingFreeMarkerViewResolver"); - } - - @Test - public void deviceDelegatingGroovyMarkupViewResolver() throws Exception { - load(Collections.singletonList(GroovyTemplateAutoConfiguration.class), - "spring.mobile.devicedelegatingviewresolver.enabled:true"); - assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class)) - .hasSize(2); - assertLiteDeviceDelegatingViewResolver( - this.context.getBean(GroovyMarkupViewResolver.class), - "deviceDelegatingGroovyMarkupViewResolver"); - } - - @Test - public void deviceDelegatingMustacheViewResolver() throws Exception { - load(Collections.singletonList(MustacheAutoConfiguration.class), - "spring.mobile.devicedelegatingviewresolver.enabled:true"); - assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class)) - .hasSize(2); - assertLiteDeviceDelegatingViewResolver( - this.context.getBean(MustacheViewResolver.class), - "deviceDelegatingMustacheViewResolver"); - } - - @Test - public void deviceDelegatingThymeleafViewResolver() throws Exception { - load(Collections.singletonList(ThymeleafAutoConfiguration.class), - "spring.mobile.devicedelegatingviewresolver.enabled:true"); - assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class)) - .hasSize(2); - assertLiteDeviceDelegatingViewResolver( - this.context.getBean(ThymeleafViewResolver.class), - "deviceDelegatingThymeleafViewResolver"); - } - - public void assertLiteDeviceDelegatingViewResolver(ViewResolver delegate, - String delegatingBeanName) { - LiteDeviceDelegatingViewResolver deviceDelegatingViewResolver = this.context - .getBean(delegatingBeanName, LiteDeviceDelegatingViewResolver.class); - assertThat(deviceDelegatingViewResolver.getViewResolver()).isSameAs(delegate); - assertThat(deviceDelegatingViewResolver.getOrder()) - .isEqualTo(((Ordered) delegate).getOrder() - 1); - } - - @Test - public void deviceDelegatingViewResolverDisabled() throws Exception { - load(Arrays.asList(FreeMarkerAutoConfiguration.class, - GroovyTemplateAutoConfiguration.class, MustacheAutoConfiguration.class, - ThymeleafAutoConfiguration.class), - "spring.mobile.devicedelegatingviewresolver.enabled:false"); - assertThat(this.context.getBeansOfType(LiteDeviceDelegatingViewResolver.class)) - .hasSize(0); - } - - @Test - public void defaultPropertyValues() throws Exception { - load("spring.mobile.devicedelegatingviewresolver.enabled:true"); - LiteDeviceDelegatingViewResolver liteDeviceDelegatingViewResolver = this.context - .getBean("deviceDelegatingJspViewResolver", - LiteDeviceDelegatingViewResolver.class); - DirectFieldAccessor accessor = new DirectFieldAccessor( - liteDeviceDelegatingViewResolver); - assertThat(accessor.getPropertyValue("enableFallback")).isEqualTo(Boolean.FALSE); - assertThat(accessor.getPropertyValue("normalPrefix")).isEqualTo(""); - assertThat(accessor.getPropertyValue("mobilePrefix")).isEqualTo("mobile/"); - assertThat(accessor.getPropertyValue("tabletPrefix")).isEqualTo("tablet/"); - assertThat(accessor.getPropertyValue("normalSuffix")).isEqualTo(""); - assertThat(accessor.getPropertyValue("mobileSuffix")).isEqualTo(""); - assertThat(accessor.getPropertyValue("tabletSuffix")).isEqualTo(""); - } - - @Test - public void overrideEnableFallback() throws Exception { - PropertyAccessor accessor = getLiteDeviceDelegatingViewResolverAccessor( - "spring.mobile.devicedelegatingviewresolver.enabled:true", - "spring.mobile.devicedelegatingviewresolver.enableFallback:true"); - assertThat(accessor.getPropertyValue("enableFallback")).isEqualTo(Boolean.TRUE); - } - - @Test - public void overrideNormalPrefix() throws Exception { - PropertyAccessor accessor = getLiteDeviceDelegatingViewResolverAccessor( - "spring.mobile.devicedelegatingviewresolver.enabled:true", - "spring.mobile.devicedelegatingviewresolver.normalPrefix:normal/"); - assertThat(accessor.getPropertyValue("normalPrefix")).isEqualTo("normal/"); - } - - @Test - public void overrideMobilePrefix() throws Exception { - PropertyAccessor accessor = getLiteDeviceDelegatingViewResolverAccessor( - "spring.mobile.devicedelegatingviewresolver.enabled:true", - "spring.mobile.devicedelegatingviewresolver.mobilePrefix:mob/"); - assertThat(accessor.getPropertyValue("mobilePrefix")).isEqualTo("mob/"); - } - - @Test - public void overrideTabletPrefix() throws Exception { - PropertyAccessor accessor = getLiteDeviceDelegatingViewResolverAccessor( - "spring.mobile.devicedelegatingviewresolver.enabled:true", - "spring.mobile.devicedelegatingviewresolver.tabletPrefix:tab/"); - assertThat(accessor.getPropertyValue("tabletPrefix")).isEqualTo("tab/"); - } - - @Test - public void overrideNormalSuffix() throws Exception { - PropertyAccessor accessor = getLiteDeviceDelegatingViewResolverAccessor( - "spring.mobile.devicedelegatingviewresolver.enabled:true", - "spring.mobile.devicedelegatingviewresolver.normalSuffix:.nor"); - assertThat(accessor.getPropertyValue("normalSuffix")).isEqualTo(".nor"); - } - - @Test - public void overrideMobileSuffix() throws Exception { - PropertyAccessor accessor = getLiteDeviceDelegatingViewResolverAccessor( - "spring.mobile.devicedelegatingviewresolver.enabled:true", - "spring.mobile.devicedelegatingviewresolver.mobileSuffix:.mob"); - assertThat(accessor.getPropertyValue("mobileSuffix")).isEqualTo(".mob"); - } - - @Test - public void overrideTabletSuffix() throws Exception { - PropertyAccessor accessor = getLiteDeviceDelegatingViewResolverAccessor( - "spring.mobile.devicedelegatingviewresolver.enabled:true", - "spring.mobile.devicedelegatingviewresolver.tabletSuffix:.tab"); - assertThat(accessor.getPropertyValue("tabletSuffix")).isEqualTo(".tab"); - } - - private PropertyAccessor getLiteDeviceDelegatingViewResolverAccessor( - String... configuration) { - load(configuration); - LiteDeviceDelegatingViewResolver liteDeviceDelegatingViewResolver = this.context - .getBean("deviceDelegatingJspViewResolver", - LiteDeviceDelegatingViewResolver.class); - return new DirectFieldAccessor(liteDeviceDelegatingViewResolver); - } - - public void load(String... environment) { - load(null, environment); - } - - public void load(List> config, String... environment) { - this.context = new AnnotationConfigWebApplicationContext(); - this.context.setServletContext(new MockServletContext()); - if (config != null) { - this.context.register(config.toArray(new Class[config.size()])); - } - this.context.register(WebMvcAutoConfiguration.class, - HttpMessageConvertersAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class, - DeviceDelegatingViewResolverAutoConfiguration.class); - TestPropertyValues.of(environment).applyTo(this.context); - this.context.refresh(); - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfigurationTests.java deleted file mode 100644 index d2a49bb857..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/DeviceResolverAutoConfigurationTests.java +++ /dev/null @@ -1,137 +0,0 @@ -/* - * Copyright 2012-2017 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.mobile; - -import org.junit.After; -import org.junit.Test; - -import org.springframework.boot.autoconfigure.ImportAutoConfiguration; -import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration; -import org.springframework.boot.autoconfigure.data.rest.RepositoryRestMvcAutoConfiguration; -import org.springframework.boot.autoconfigure.data.web.SpringDataWebAutoConfiguration; -import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration; -import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.mobile.device.Device; -import org.springframework.mobile.device.DeviceHandlerMethodArgumentResolver; -import org.springframework.mobile.device.DeviceResolverHandlerInterceptor; -import org.springframework.mock.web.MockHttpServletRequest; -import org.springframework.mock.web.MockServletContext; -import org.springframework.stereotype.Controller; -import org.springframework.test.web.servlet.MockMvc; -import org.springframework.test.web.servlet.setup.MockMvcBuilders; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; -import org.springframework.web.servlet.HandlerInterceptor; -import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; - -import static org.assertj.core.api.Assertions.assertThat; -import static org.springframework.test.web.servlet.request.MockMvcRequestBuilders.get; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -/** - * Tests for {@link DeviceResolverAutoConfiguration}. - * - * @author Roy Clarkson - * @author Andy Wilkinson - */ -public class DeviceResolverAutoConfigurationTests { - - private AnnotationConfigWebApplicationContext context; - - @After - public void close() { - if (this.context != null) { - this.context.close(); - } - } - - @Test - public void deviceResolverHandlerInterceptorCreated() throws Exception { - this.context = new AnnotationConfigWebApplicationContext(); - this.context.register(DeviceResolverAutoConfiguration.class); - this.context.refresh(); - assertThat(this.context.getBean(DeviceResolverHandlerInterceptor.class)) - .isNotNull(); - } - - @Test - public void deviceHandlerMethodArgumentResolverCreated() throws Exception { - this.context = new AnnotationConfigWebApplicationContext(); - this.context.register(DeviceResolverAutoConfiguration.class); - this.context.refresh(); - assertThat(this.context.getBean(DeviceHandlerMethodArgumentResolver.class)) - .isNotNull(); - } - - @Test - public void deviceResolverHandlerInterceptorRegistered() throws Exception { - this.context = new AnnotationConfigWebApplicationContext(); - this.context.setServletContext(new MockServletContext()); - this.context.register(Config.class); - this.context.refresh(); - RequestMappingHandlerMapping mapping = this.context - .getBean(RequestMappingHandlerMapping.class); - HandlerInterceptor[] interceptors = mapping - .getHandler(new MockHttpServletRequest()).getInterceptors(); - assertThat(interceptors) - .hasAtLeastOneElementOfType(DeviceResolverHandlerInterceptor.class); - } - - @Test - public void deviceHandlerMethodArgumentWorksWithSpringData() throws Exception { - this.context = new AnnotationConfigWebApplicationContext(); - this.context.register(Config.class); - this.context.setServletContext(new MockServletContext()); - this.context.refresh(); - MockMvc mockMvc = MockMvcBuilders.webAppContextSetup(this.context).build(); - mockMvc.perform(get("/")).andExpect(status().isOk()); - } - - @Configuration - @ImportAutoConfiguration({ WebMvcAutoConfiguration.class, - HttpMessageConvertersAutoConfiguration.class, - DeviceResolverAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class, - SpringDataWebAutoConfiguration.class, - RepositoryRestMvcAutoConfiguration.class }) - protected static class Config { - - @Bean - public MyController controller() { - return new MyController(); - } - - } - - @Controller - protected static class MyController { - - @RequestMapping("/") - public ResponseEntity test(Device device) { - if (device.getDevicePlatform() != null) { - return new ResponseEntity<>(HttpStatus.OK); - } - return new ResponseEntity<>(HttpStatus.INTERNAL_SERVER_ERROR); - } - - } - -} diff --git a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfigurationTests.java b/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfigurationTests.java deleted file mode 100644 index 233b018af4..0000000000 --- a/spring-boot-project/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/mobile/SitePreferenceAutoConfigurationTests.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright 2012-2017 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.mobile; - -import org.junit.After; -import org.junit.Test; - -import org.springframework.beans.factory.NoSuchBeanDefinitionException; -import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration; -import org.springframework.boot.autoconfigure.http.HttpMessageConvertersAutoConfiguration; -import org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration; -import org.springframework.boot.test.util.TestPropertyValues; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.mobile.device.site.SitePreferenceHandlerInterceptor; -import org.springframework.mobile.device.site.SitePreferenceHandlerMethodArgumentResolver; -import org.springframework.mock.web.MockHttpServletRequest; -import org.springframework.mock.web.MockServletContext; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.context.support.AnnotationConfigWebApplicationContext; -import org.springframework.web.servlet.HandlerInterceptor; -import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; - -import static org.assertj.core.api.Assertions.assertThat; - -/** - * Tests for {@link SitePreferenceAutoConfiguration}. - * - * @author Roy Clarkson - * @author Andy Wilkinson - */ -public class SitePreferenceAutoConfigurationTests { - - private AnnotationConfigWebApplicationContext context; - - @After - public void close() { - if (this.context != null) { - this.context.close(); - } - } - - @Test - public void sitePreferenceHandlerInterceptorCreated() { - this.context = new AnnotationConfigWebApplicationContext(); - this.context.register(SitePreferenceAutoConfiguration.class); - this.context.refresh(); - assertThat(this.context.getBean(SitePreferenceHandlerInterceptor.class)) - .isNotNull(); - } - - @Test - public void sitePreferenceHandlerInterceptorEnabled() throws Exception { - this.context = new AnnotationConfigWebApplicationContext(); - TestPropertyValues.of("spring.mobile.sitepreference.enabled:true") - .applyTo(this.context); - this.context.register(SitePreferenceAutoConfiguration.class); - this.context.refresh(); - assertThat(this.context.getBean(SitePreferenceHandlerInterceptor.class)) - .isNotNull(); - } - - @Test(expected = NoSuchBeanDefinitionException.class) - public void sitePreferenceHandlerInterceptorDisabled() { - this.context = new AnnotationConfigWebApplicationContext(); - TestPropertyValues.of("spring.mobile.sitepreference.enabled:false") - .applyTo(this.context); - this.context.register(SitePreferenceAutoConfiguration.class); - this.context.refresh(); - this.context.getBean(SitePreferenceHandlerInterceptor.class); - } - - @Test - public void sitePreferenceMethodArgumentResolverCreated() throws Exception { - this.context = new AnnotationConfigWebApplicationContext(); - this.context.register(SitePreferenceAutoConfiguration.class); - this.context.refresh(); - assertThat( - this.context.getBean(SitePreferenceHandlerMethodArgumentResolver.class)) - .isNotNull(); - } - - @Test - public void sitePreferenceMethodArgumentResolverEnabled() throws Exception { - this.context = new AnnotationConfigWebApplicationContext(); - TestPropertyValues.of("spring.mobile.sitepreference.enabled:true") - .applyTo(this.context); - this.context.register(SitePreferenceAutoConfiguration.class); - this.context.refresh(); - assertThat( - this.context.getBean(SitePreferenceHandlerMethodArgumentResolver.class)) - .isNotNull(); - } - - @Test(expected = NoSuchBeanDefinitionException.class) - public void sitePreferenceMethodArgumentResolverDisabled() { - this.context = new AnnotationConfigWebApplicationContext(); - TestPropertyValues.of("spring.mobile.sitepreference.enabled:false") - .applyTo(this.context); - this.context.register(SitePreferenceAutoConfiguration.class); - this.context.refresh(); - this.context.getBean(SitePreferenceHandlerMethodArgumentResolver.class); - } - - @Test - public void sitePreferenceHandlerInterceptorRegistered() throws Exception { - this.context = new AnnotationConfigWebApplicationContext(); - this.context.setServletContext(new MockServletContext()); - this.context.register(Config.class, WebMvcAutoConfiguration.class, - HttpMessageConvertersAutoConfiguration.class, - SitePreferenceAutoConfiguration.class, - PropertyPlaceholderAutoConfiguration.class); - this.context.refresh(); - RequestMappingHandlerMapping mapping = this.context - .getBean(RequestMappingHandlerMapping.class); - HandlerInterceptor[] interceptors = mapping - .getHandler(new MockHttpServletRequest()).getInterceptors(); - assertThat(interceptors) - .hasAtLeastOneElementOfType(SitePreferenceHandlerInterceptor.class); - } - - @Configuration - protected static class Config { - - @Bean - public MyController controller() { - return new MyController(); - } - - } - - @Controller - protected static class MyController { - - @RequestMapping("/") - public void test() { - - } - - } - -} diff --git a/spring-boot-project/spring-boot-cli/samples/device.groovy b/spring-boot-project/spring-boot-cli/samples/device.groovy deleted file mode 100644 index 48719f84f8..0000000000 --- a/spring-boot-project/spring-boot-cli/samples/device.groovy +++ /dev/null @@ -1,21 +0,0 @@ -package org.test - -@Controller -@EnableDeviceResolver -class Example { - - @RequestMapping("/") - @ResponseBody - String helloWorld(Device device) { - if (device.isNormal()) { - "Hello Normal Device!" - } else if (device.isMobile()) { - "Hello Mobile Device!" - } else if (device.isTablet()) { - "Hello Tablet Device!" - } else { - "Hello Unknown Device!" - } - } - -} diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMobileCompilerAutoConfiguration.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMobileCompilerAutoConfiguration.java deleted file mode 100644 index b08a067786..0000000000 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/cli/compiler/autoconfigure/SpringMobileCompilerAutoConfiguration.java +++ /dev/null @@ -1,53 +0,0 @@ -/* - * Copyright 2012-2017 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.cli.compiler.autoconfigure; - -import org.codehaus.groovy.ast.ClassNode; -import org.codehaus.groovy.control.CompilationFailedException; -import org.codehaus.groovy.control.customizers.ImportCustomizer; - -import org.springframework.boot.cli.compiler.AstUtils; -import org.springframework.boot.cli.compiler.CompilerAutoConfiguration; -import org.springframework.boot.cli.compiler.DependencyCustomizer; -import org.springframework.boot.groovy.EnableDeviceResolver; - -/** - * {@link CompilerAutoConfiguration} for Spring Mobile. - * - * @author Roy Clarkson - * @author Dave Syer - */ -public class SpringMobileCompilerAutoConfiguration extends CompilerAutoConfiguration { - - @Override - public boolean matches(ClassNode classNode) { - return AstUtils.hasAtLeastOneAnnotation(classNode, "EnableDeviceResolver"); - } - - @Override - public void applyDependencies(DependencyCustomizer dependencies) - throws CompilationFailedException { - dependencies.add("spring-boot-starter-mobile"); - } - - @Override - public void applyImports(ImportCustomizer imports) throws CompilationFailedException { - imports.addStarImports("org.springframework.mobile.device"); - imports.addImports(EnableDeviceResolver.class.getCanonicalName()); - } - -} diff --git a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/groovy/EnableDeviceResolver.java b/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/groovy/EnableDeviceResolver.java deleted file mode 100644 index 97ee82f17f..0000000000 --- a/spring-boot-project/spring-boot-cli/src/main/java/org/springframework/boot/groovy/EnableDeviceResolver.java +++ /dev/null @@ -1,37 +0,0 @@ -/* - * Copyright 2012-2017 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.groovy; - -import java.lang.annotation.Documented; -import java.lang.annotation.ElementType; -import java.lang.annotation.Retention; -import java.lang.annotation.RetentionPolicy; -import java.lang.annotation.Target; - -import org.springframework.boot.cli.compiler.autoconfigure.SpringMobileCompilerAutoConfiguration; - -/** - * Pseudo annotation used to trigger {@link SpringMobileCompilerAutoConfiguration}. - * - * @author Phillip Webb - */ -@Target(ElementType.TYPE) -@Documented -@Retention(RetentionPolicy.RUNTIME) -public @interface EnableDeviceResolver { - -} diff --git a/spring-boot-project/spring-boot-cli/src/main/resources/META-INF/services/org.springframework.boot.cli.compiler.CompilerAutoConfiguration b/spring-boot-project/spring-boot-cli/src/main/resources/META-INF/services/org.springframework.boot.cli.compiler.CompilerAutoConfiguration index 20ff0c6126..ea65af15b5 100644 --- a/spring-boot-project/spring-boot-cli/src/main/resources/META-INF/services/org.springframework.boot.cli.compiler.CompilerAutoConfiguration +++ b/spring-boot-project/spring-boot-cli/src/main/resources/META-INF/services/org.springframework.boot.cli.compiler.CompilerAutoConfiguration @@ -9,7 +9,6 @@ org.springframework.boot.cli.compiler.autoconfigure.JmsCompilerAutoConfiguration org.springframework.boot.cli.compiler.autoconfigure.TransactionManagementCompilerAutoConfiguration org.springframework.boot.cli.compiler.autoconfigure.SpringIntegrationCompilerAutoConfiguration org.springframework.boot.cli.compiler.autoconfigure.SpringSecurityCompilerAutoConfiguration -org.springframework.boot.cli.compiler.autoconfigure.SpringMobileCompilerAutoConfiguration org.springframework.boot.cli.compiler.autoconfigure.SpringRetryCompilerAutoConfiguration org.springframework.boot.cli.compiler.autoconfigure.SpringSocialFacebookCompilerAutoConfiguration org.springframework.boot.cli.compiler.autoconfigure.SpringSocialLinkedInCompilerAutoConfiguration diff --git a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java index 98faec912f..8ed23629a9 100644 --- a/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java +++ b/spring-boot-project/spring-boot-cli/src/test/java/org/springframework/boot/cli/SampleIntegrationTests.java @@ -144,12 +144,6 @@ public class SampleIntegrationTests { assertThat(output).contains("Received Greetings from Spring Boot via RabbitMQ"); } - @Test - public void deviceSample() throws Exception { - this.cli.run("device.groovy"); - assertThat(this.cli.getHttpOutput()).isEqualTo("Hello Normal Device!"); - } - @Test public void caching() throws Exception { assertThat(this.cli.run("caching.groovy")).contains("Hello World"); diff --git a/spring-boot-project/spring-boot-dependencies/pom.xml b/spring-boot-project/spring-boot-dependencies/pom.xml index eb7dbb338c..0502e8021d 100644 --- a/spring-boot-project/spring-boot-dependencies/pom.xml +++ b/spring-boot-project/spring-boot-dependencies/pom.xml @@ -151,7 +151,6 @@ 5.0.0.M7 2.0.0.RELEASE 2.3.2.RELEASE - 2.0.0.M1 1.2.0.RELEASE 2.0.0.RC1 1.2.1.RELEASE @@ -2649,11 +2648,6 @@ spring-ldap-test ${spring-ldap.version} - - org.springframework.mobile - spring-mobile-device - ${spring-mobile.version} - org.springframework.plugin spring-plugin-core diff --git a/spring-boot-project/spring-boot-docs/pom.xml b/spring-boot-project/spring-boot-docs/pom.xml index 450b518813..820e4f60f4 100644 --- a/spring-boot-project/spring-boot-docs/pom.xml +++ b/spring-boot-project/spring-boot-docs/pom.xml @@ -812,11 +812,6 @@ spring-hateoas true - - org.springframework.mobile - spring-mobile-device - true - org.springframework.restdocs spring-restdocs-mockmvc diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc index 6ad5d6aead..8182bd40ab 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/appendix-application-properties.adoc @@ -353,19 +353,6 @@ content into your application; rather pick only the properties that you need. spring.ldap.embedded.validation.enabled=true # Enable LDAP schema validation. spring.ldap.embedded.validation.schema= # Path to the custom schema. - # SPRING MOBILE DEVICE VIEWS ({sc-spring-boot-autoconfigure}/mobile/DeviceDelegatingViewResolverAutoConfiguration.{sc-ext}[DeviceDelegatingViewResolverAutoConfiguration]) - spring.mobile.devicedelegatingviewresolver.enable-fallback=false # Enable support for fallback resolution. - spring.mobile.devicedelegatingviewresolver.enabled=false # Enable device view resolver. - spring.mobile.devicedelegatingviewresolver.mobile-prefix=mobile/ # Prefix that gets prepended to view names for mobile devices. - spring.mobile.devicedelegatingviewresolver.mobile-suffix= # Suffix that gets appended to view names for mobile devices. - spring.mobile.devicedelegatingviewresolver.normal-prefix= # Prefix that gets prepended to view names for normal devices. - spring.mobile.devicedelegatingviewresolver.normal-suffix= # Suffix that gets appended to view names for normal devices. - spring.mobile.devicedelegatingviewresolver.tablet-prefix=tablet/ # Prefix that gets prepended to view names for tablet devices. - spring.mobile.devicedelegatingviewresolver.tablet-suffix= # Suffix that gets appended to view names for tablet devices. - - # SPRING MOBILE SITE PREFERENCE ({sc-spring-boot-autoconfigure}/mobile/SitePreferenceAutoConfiguration.{sc-ext}[SitePreferenceAutoConfiguration]) - spring.mobile.sitepreference.enabled=true # Enable SitePreferenceHandler. - # MUSTACHE TEMPLATES ({sc-spring-boot-autoconfigure}/mustache/MustacheAutoConfiguration.{sc-ext}[MustacheAutoConfiguration]) spring.mustache.allow-request-override= # Set whether HttpServletRequest attributes are allowed to override (hide) controller generated model attributes of the same name. spring.mustache.allow-session-override= # Set whether HttpSession attributes are allowed to override (hide) controller generated model attributes of the same name. diff --git a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-cli.adoc b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-cli.adoc index faa1c00480..40525e148c 100644 --- a/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-cli.adoc +++ b/spring-boot-project/spring-boot-docs/src/main/asciidoc/spring-boot-cli.adoc @@ -166,9 +166,6 @@ The following items are used as "`grab hints`": |`@MessageEndpoint` `@EnableIntegrationPatterns` |Spring Integration. -|`@EnableDeviceResolver` -|Spring Mobile. - |`@Controller` `@RestController` `@EnableWebMvc` |Spring MVC + Embedded Tomcat. diff --git a/spring-boot-project/spring-boot-starters/pom.xml b/spring-boot-project/spring-boot-starters/pom.xml index bc1270dbeb..60d1360616 100644 --- a/spring-boot-project/spring-boot-starters/pom.xml +++ b/spring-boot-project/spring-boot-starters/pom.xml @@ -51,7 +51,6 @@ spring-boot-starter-logging spring-boot-starter-log4j2 spring-boot-starter-mail - spring-boot-starter-mobile spring-boot-starter-mustache spring-boot-starter-actuator spring-boot-starter-parent diff --git a/spring-boot-project/spring-boot-starters/spring-boot-starter-mobile/pom.xml b/spring-boot-project/spring-boot-starters/spring-boot-starter-mobile/pom.xml deleted file mode 100644 index 0d3b44ca91..0000000000 --- a/spring-boot-project/spring-boot-starters/spring-boot-starter-mobile/pom.xml +++ /dev/null @@ -1,52 +0,0 @@ - - - 4.0.0 - - org.springframework.boot - spring-boot-starters - ${revision} - - spring-boot-starter-mobile - Spring Boot Mobile Starter - Starter for building web applications using Spring Mobile - - ${basedir}/../../.. - - - - org.springframework.boot - spring-boot-starter - - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.mobile - spring-mobile-device - - - - - - org.basepom.maven - duplicate-finder-maven-plugin - - - duplicate-dependencies - validate - - check - - - - javax.annotation.* - - - - - - - - diff --git a/spring-boot-project/spring-boot-starters/spring-boot-starter-mobile/src/main/resources/META-INF/spring.provides b/spring-boot-project/spring-boot-starters/spring-boot-starter-mobile/src/main/resources/META-INF/spring.provides deleted file mode 100644 index 9247d2ad47..0000000000 --- a/spring-boot-project/spring-boot-starters/spring-boot-starter-mobile/src/main/resources/META-INF/spring.provides +++ /dev/null @@ -1 +0,0 @@ -provides: spring-mobile-device \ No newline at end of file