From 61f7bd8576a6e4d52976ebb6df067e422b61f806 Mon Sep 17 00:00:00 2001 From: Phillip Webb Date: Tue, 30 Jan 2018 12:31:49 -0800 Subject: [PATCH 1/2] Polish --- .../ManagementWebSecurityAutoConfiguration.java | 2 +- .../OAuth2RestOperationsConfiguration.java | 4 ++-- .../OAuth2RestOperationsConfigurationTests.java | 17 ++++++++--------- .../launchscript/SysVinitLaunchScriptIT.java | 2 +- .../boot/configurationprocessor/TypeUtils.java | 14 ++++++-------- .../boot/jdbc/DatabaseDriver.java | 5 ++--- .../boot/web/client/RestTemplateBuilder.java | 7 ++++--- ...ttyEmbeddedServletContainerFactoryTests.java | 2 +- 8 files changed, 25 insertions(+), 28 deletions(-) diff --git a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java index 1b5ad03f558d..f9a644cfaa76 100644 --- a/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java +++ b/spring-boot-actuator/src/main/java/org/springframework/boot/actuate/autoconfigure/ManagementWebSecurityAutoConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java index b48577acd5ba..f7c15f9c51f1 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfiguration.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -87,7 +87,7 @@ public DefaultOAuth2ClientContext oauth2ClientContext() { @Configuration @ConditionalOnBean(OAuth2ClientConfiguration.class) - @Conditional({OAuth2ClientIdCondition.class, NoClientCredentialsCondition.class}) + @Conditional({ OAuth2ClientIdCondition.class, NoClientCredentialsCondition.class }) @Import(OAuth2ProtectedResourceDetailsConfiguration.class) protected static class SessionScopedConfiguration { diff --git a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfigurationTests.java b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfigurationTests.java index dd14ce3cd633..d00d521fb6b1 100644 --- a/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfigurationTests.java +++ b/spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/security/oauth2/client/OAuth2RestOperationsConfigurationTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -78,8 +78,7 @@ public void requestScopedWithClientId() throws Exception { EnvironmentTestUtils.addEnvironment(this.environment, "security.oauth2.client.client-id=acme"); initializeContext(ConfigForRequestScopedConfiguration.class, false); - assertThat(this.context.containsBean("oauth2ClientContext")) - .isTrue(); + assertThat(this.context.containsBean("oauth2ClientContext")).isTrue(); } @Test @@ -95,8 +94,7 @@ public void sessionScopedWithClientId() throws Exception { EnvironmentTestUtils.addEnvironment(this.environment, "security.oauth2.client.client-id=acme"); initializeContext(ConfigForSessionScopedConfiguration.class, false); - assertThat(this.context.containsBean("oauth2ClientContext")) - .isTrue(); + assertThat(this.context.containsBean("oauth2ClientContext")).isTrue(); } @Test @@ -109,8 +107,7 @@ public void sessionScopedWithNoClientId() throws Exception { private void initializeContext(Class configuration, boolean isClientCredentials) { this.context = new SpringApplicationBuilder(configuration) - .environment(this.environment) - .web(!isClientCredentials).run(); + .environment(this.environment).web(!isClientCredentials).run(); } @Configuration @@ -126,7 +123,8 @@ public MockEmbeddedServletContainerFactory embeddedServletContainerFactory() { @Configuration @Import({ OAuth2ClientConfiguration.class, OAuth2RestOperationsConfiguration.class }) - protected static class ConfigForSessionScopedConfiguration extends WebApplicationConfiguration { + protected static class ConfigForSessionScopedConfiguration + extends WebApplicationConfiguration { @Bean public SecurityProperties securityProperties() { @@ -136,7 +134,8 @@ public SecurityProperties securityProperties() { } @Configuration - protected static class ConfigForRequestScopedConfiguration extends WebApplicationConfiguration { + protected static class ConfigForRequestScopedConfiguration + extends WebApplicationConfiguration { } diff --git a/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java b/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java index 42860f75e4de..ad134c23c476 100644 --- a/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java +++ b/spring-boot-integration-tests/spring-boot-launch-script-tests/src/test/java/org/springframework/boot/launchscript/SysVinitLaunchScriptIT.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. diff --git a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java index 68ff2041d39a..54222725e5ea 100644 --- a/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java +++ b/spring-boot-tools/spring-boot-configuration-processor/src/main/java/org/springframework/boot/configurationprocessor/TypeUtils.java @@ -188,17 +188,15 @@ public String visitDeclared(DeclaredType type, Void none) { + type.asElement().getSimpleName().toString(); } String qualifiedName = getQualifiedName(type.asElement()); - if (type.getTypeArguments().isEmpty()) { + if (type.getTypeArguments().isEmpty()) { return qualifiedName; } - else { - StringBuilder name = new StringBuilder(); - name.append(qualifiedName); - if (!type.getTypeArguments().isEmpty()) { - appendTypeArguments(type, name); - } - return name.toString(); + StringBuilder name = new StringBuilder(); + name.append(qualifiedName); + if (!type.getTypeArguments().isEmpty()) { + appendTypeArguments(type, name); } + return name.toString(); } private void appendTypeArguments(DeclaredType type, StringBuilder name) { diff --git a/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java b/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java index 18d78e9c3e87..c2eab5f49ba0 100644 --- a/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java +++ b/spring-boot/src/main/java/org/springframework/boot/jdbc/DatabaseDriver.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. @@ -123,8 +123,7 @@ protected boolean matchProductName(String productName) { * Firebird. */ FIREBIRD("Firebird", "org.firebirdsql.jdbc.FBDriver", - "org.firebirdsql.ds.FBXADataSource", - "SELECT 1 FROM RDB$DATABASE") { + "org.firebirdsql.ds.FBXADataSource", "SELECT 1 FROM RDB$DATABASE") { @Override protected Collection getUrlPrefixes() { diff --git a/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java b/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java index 7b73e90b8504..f27c972a1da4 100644 --- a/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java +++ b/spring-boot/src/main/java/org/springframework/boot/web/client/RestTemplateBuilder.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2016 the original author or authors. + * Copyright 2012-2018 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. @@ -337,8 +337,9 @@ private ClientHttpRequestFactory createRequestFactory( /** * Set the {@link ClientHttpRequestFactory} that should be used with the * {@link RestTemplate}. - *

Note that this request factory will be shared with all builder instances - * derived from that point. + *

+ * Note that this request factory will be shared with all builder instances derived + * from that point. * @param requestFactory the request factory to use * @return a new builder instance */ diff --git a/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java b/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java index 1d8eabaeb443..cce0048cd660 100644 --- a/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java +++ b/spring-boot/src/test/java/org/springframework/boot/context/embedded/jetty/JettyEmbeddedServletContainerFactoryTests.java @@ -1,5 +1,5 @@ /* - * Copyright 2012-2017 the original author or authors. + * Copyright 2012-2018 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. From 38a5466a1923a926525dd46fc792d2fefc9df1b4 Mon Sep 17 00:00:00 2001 From: Jacques Stadler Date: Tue, 30 Jan 2018 16:22:56 +0100 Subject: [PATCH 2/2] All CLI support for Windows MINGW environments Closes gh-11848 --- spring-boot-cli/src/main/executablecontent/bin/spring | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/spring-boot-cli/src/main/executablecontent/bin/spring b/spring-boot-cli/src/main/executablecontent/bin/spring index 0ba9c5d66ff6..21ba6a064b25 100755 --- a/spring-boot-cli/src/main/executablecontent/bin/spring +++ b/spring-boot-cli/src/main/executablecontent/bin/spring @@ -8,6 +8,10 @@ case "`uname`" in cygwin=true ;; + MINGW*) + cygwin=true + ;; + Darwin*) darwin=true ;;