Commit 5881c9c7 authored by Phillip Webb's avatar Phillip Webb

Polish

parent 43256ee7
...@@ -93,12 +93,12 @@ import org.springframework.util.StringUtils; ...@@ -93,12 +93,12 @@ import org.springframework.util.StringUtils;
* <p> * <p>
* If a Spring Security {@link AuthenticationManager} is detected, this configuration will * If a Spring Security {@link AuthenticationManager} is detected, this configuration will
* create a {@link CRaSHPlugin} to forward shell authentication requests to Spring * create a {@link CRaSHPlugin} to forward shell authentication requests to Spring
* Security. This authentication method will get enabled if {@code management.shell.auth.type} * Security. This authentication method will get enabled if
* is set to {@code spring} or if no explicit {@code management.shell.auth} is provided * {@code management.shell.auth.type} is set to {@code spring} or if no explicit
* and a {@link AuthenticationManager} is available. In the latter case shell access will * {@code management.shell.auth} is provided and a {@link AuthenticationManager} is
* be restricted to users having roles that match those configured in * available. In the latter case shell access will be restricted to users having roles
* {@link ManagementServerProperties}. Required roles can be overridden by * that match those configured in {@link ManagementServerProperties}. Required roles can
* {@code management.shell.auth.spring.roles}. * be overridden by {@code management.shell.auth.spring.roles}.
* <p> * <p>
* To add customizations to the shell simply define beans of type {@link CRaSHPlugin} in * To add customizations to the shell simply define beans of type {@link CRaSHPlugin} in
* the application context. Those beans will get auto detected during startup and * the application context. Those beans will get auto detected during startup and
......
...@@ -38,4 +38,5 @@ import org.springframework.beans.factory.annotation.Value; ...@@ -38,4 +38,5 @@ import org.springframework.beans.factory.annotation.Value;
@Documented @Documented
@Value("${local.management.port}") @Value("${local.management.port}")
public @interface LocalManagementPort { public @interface LocalManagementPort {
} }
...@@ -375,7 +375,8 @@ public class ShellProperties { ...@@ -375,7 +375,8 @@ public class ShellProperties {
/** /**
* Auth specific properties for JAAS authentication. * Auth specific properties for JAAS authentication.
*/ */
@ConfigurationProperties(prefix = SHELL_PREFIX + ".auth.jaas", ignoreUnknownFields = false) @ConfigurationProperties(prefix = SHELL_PREFIX
+ ".auth.jaas", ignoreUnknownFields = false)
public static class JaasAuthenticationProperties public static class JaasAuthenticationProperties
extends CrshShellAuthenticationProperties { extends CrshShellAuthenticationProperties {
...@@ -404,7 +405,8 @@ public class ShellProperties { ...@@ -404,7 +405,8 @@ public class ShellProperties {
/** /**
* Auth specific properties for key authentication. * Auth specific properties for key authentication.
*/ */
@ConfigurationProperties(prefix = SHELL_PREFIX + ".auth.key", ignoreUnknownFields = false) @ConfigurationProperties(prefix = SHELL_PREFIX
+ ".auth.key", ignoreUnknownFields = false)
public static class KeyAuthenticationProperties public static class KeyAuthenticationProperties
extends CrshShellAuthenticationProperties { extends CrshShellAuthenticationProperties {
...@@ -435,7 +437,8 @@ public class ShellProperties { ...@@ -435,7 +437,8 @@ public class ShellProperties {
/** /**
* Auth specific properties for simple authentication. * Auth specific properties for simple authentication.
*/ */
@ConfigurationProperties(prefix = SHELL_PREFIX + ".auth.simple", ignoreUnknownFields = false) @ConfigurationProperties(prefix = SHELL_PREFIX
+ ".auth.simple", ignoreUnknownFields = false)
public static class SimpleAuthenticationProperties public static class SimpleAuthenticationProperties
extends CrshShellAuthenticationProperties { extends CrshShellAuthenticationProperties {
...@@ -511,7 +514,8 @@ public class ShellProperties { ...@@ -511,7 +514,8 @@ public class ShellProperties {
/** /**
* Auth specific properties for Spring authentication. * Auth specific properties for Spring authentication.
*/ */
@ConfigurationProperties(prefix = SHELL_PREFIX + ".auth.spring", ignoreUnknownFields = false) @ConfigurationProperties(prefix = SHELL_PREFIX
+ ".auth.spring", ignoreUnknownFields = false)
public static class SpringAuthenticationProperties public static class SpringAuthenticationProperties
extends CrshShellAuthenticationProperties { extends CrshShellAuthenticationProperties {
......
...@@ -81,8 +81,8 @@ public class CrshAutoConfigurationTests { ...@@ -81,8 +81,8 @@ public class CrshAutoConfigurationTests {
@Test @Test
public void testDisabledPlugins() throws Exception { public void testDisabledPlugins() throws Exception {
load("management.shell.disabled_plugins=" + load("management.shell.disabled_plugins="
"termIOHandler, org.crsh.auth.AuthenticationPlugin, javaLanguage"); + "termIOHandler, org.crsh.auth.AuthenticationPlugin, javaLanguage");
PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class); PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
assertThat(lifeCycle).isNotNull(); assertThat(lifeCycle).isNotNull();
assertThat(lifeCycle.getContext().getPlugins(TermIOHandler.class)) assertThat(lifeCycle.getContext().getPlugins(TermIOHandler.class))
...@@ -109,8 +109,7 @@ public class CrshAutoConfigurationTests { ...@@ -109,8 +109,7 @@ public class CrshAutoConfigurationTests {
@Test @Test
public void testSshConfiguration() { public void testSshConfiguration() {
load("management.shell.ssh.enabled=true", load("management.shell.ssh.enabled=true", "management.shell.ssh.port=3333");
"management.shell.ssh.port=3333");
PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class); PluginLifeCycle lifeCycle = this.context.getBean(PluginLifeCycle.class);
assertThat(lifeCycle.getConfig().getProperty("crash.ssh.port")).isEqualTo("3333"); assertThat(lifeCycle.getConfig().getProperty("crash.ssh.port")).isEqualTo("3333");
assertThat(lifeCycle.getConfig().getProperty("crash.ssh.auth_timeout")) assertThat(lifeCycle.getConfig().getProperty("crash.ssh.auth_timeout"))
...@@ -140,7 +139,6 @@ public class CrshAutoConfigurationTests { ...@@ -140,7 +139,6 @@ public class CrshAutoConfigurationTests {
.isEqualTo("400000"); .isEqualTo("400000");
} }
@Test @Test
public void testCommandResolution() { public void testCommandResolution() {
load(); load();
...@@ -329,7 +327,6 @@ public class CrshAutoConfigurationTests { ...@@ -329,7 +327,6 @@ public class CrshAutoConfigurationTests {
this.context.refresh(); this.context.refresh();
} }
@Configuration @Configuration
public static class SecurityConfiguration { public static class SecurityConfiguration {
......
...@@ -65,7 +65,8 @@ public class ShellPropertiesTests { ...@@ -65,7 +65,8 @@ public class ShellPropertiesTests {
@Test @Test
public void testBindingAuth() { public void testBindingAuth() {
ShellProperties props = load(ShellProperties.class, "management.shell.auth.type=spring"); ShellProperties props = load(ShellProperties.class,
"management.shell.auth.type=spring");
assertThat(props.getAuth().getType()).isEqualTo("spring"); assertThat(props.getAuth().getType()).isEqualTo("spring");
} }
...@@ -78,7 +79,8 @@ public class ShellPropertiesTests { ...@@ -78,7 +79,8 @@ public class ShellPropertiesTests {
@Test @Test
public void testBindingCommandRefreshInterval() { public void testBindingCommandRefreshInterval() {
ShellProperties props = load(ShellProperties.class, "management.shell.command-refresh-interval=1"); ShellProperties props = load(ShellProperties.class,
"management.shell.command-refresh-interval=1");
assertThat(props.getCommandRefreshInterval()).isEqualTo(1); assertThat(props.getCommandRefreshInterval()).isEqualTo(1);
} }
...@@ -87,7 +89,7 @@ public class ShellPropertiesTests { ...@@ -87,7 +89,7 @@ public class ShellPropertiesTests {
ShellProperties props = load(ShellProperties.class, ShellProperties props = load(ShellProperties.class,
"management.shell.command-path-patterns=pattern1, pattern2"); "management.shell.command-path-patterns=pattern1, pattern2");
assertThat(props.getCommandPathPatterns().length).isEqualTo(2); assertThat(props.getCommandPathPatterns().length).isEqualTo(2);
Assert.assertArrayEquals(new String[] {"pattern1", "pattern2"}, Assert.assertArrayEquals(new String[] { "pattern1", "pattern2" },
props.getCommandPathPatterns()); props.getCommandPathPatterns());
} }
...@@ -96,7 +98,7 @@ public class ShellPropertiesTests { ...@@ -96,7 +98,7 @@ public class ShellPropertiesTests {
ShellProperties props = load(ShellProperties.class, ShellProperties props = load(ShellProperties.class,
"management.shell.config-path-patterns=pattern1, pattern2"); "management.shell.config-path-patterns=pattern1, pattern2");
assertThat(props.getConfigPathPatterns().length).isEqualTo(2); assertThat(props.getConfigPathPatterns().length).isEqualTo(2);
Assert.assertArrayEquals(new String[] {"pattern1", "pattern2"}, Assert.assertArrayEquals(new String[] { "pattern1", "pattern2" },
props.getConfigPathPatterns()); props.getConfigPathPatterns());
} }
...@@ -118,8 +120,7 @@ public class ShellPropertiesTests { ...@@ -118,8 +120,7 @@ public class ShellPropertiesTests {
@Test @Test
public void testBindingSsh() { public void testBindingSsh() {
ShellProperties props = load(ShellProperties.class, ShellProperties props = load(ShellProperties.class,
"management.shell.ssh.enabled=true", "management.shell.ssh.enabled=true", "management.shell.ssh.port=2222",
"management.shell.ssh.port=2222",
"management.shell.ssh.key-path=~/.ssh/test.pem"); "management.shell.ssh.key-path=~/.ssh/test.pem");
Properties p = props.asCrshShellConfig(); Properties p = props.asCrshShellConfig();
assertThat(p.get("crash.ssh.port")).isEqualTo("2222"); assertThat(p.get("crash.ssh.port")).isEqualTo("2222");
...@@ -129,8 +130,7 @@ public class ShellPropertiesTests { ...@@ -129,8 +130,7 @@ public class ShellPropertiesTests {
@Test @Test
public void testBindingSshIgnored() { public void testBindingSshIgnored() {
ShellProperties props = load(ShellProperties.class, ShellProperties props = load(ShellProperties.class,
"management.shell.ssh.enabled=false", "management.shell.ssh.enabled=false", "management.shell.ssh.port=2222",
"management.shell.ssh.port=2222",
"management.shell.ssh.key-path=~/.ssh/test.pem"); "management.shell.ssh.key-path=~/.ssh/test.pem");
Properties p = props.asCrshShellConfig(); Properties p = props.asCrshShellConfig();
assertThat(p.get("crash.ssh.port")).isNull(); assertThat(p.get("crash.ssh.port")).isNull();
...@@ -194,14 +194,16 @@ public class ShellPropertiesTests { ...@@ -194,14 +194,16 @@ public class ShellPropertiesTests {
@Test @Test
public void testDefaultPasswordAutoGeneratedIfUnresolvedPlaceholder() { public void testDefaultPasswordAutoGeneratedIfUnresolvedPlaceholder() {
SimpleAuthenticationProperties security = load(SimpleAuthenticationProperties.class, SimpleAuthenticationProperties security = load(
SimpleAuthenticationProperties.class,
"management.shell.auth.simple.user.password=${ADMIN_PASSWORD}"); "management.shell.auth.simple.user.password=${ADMIN_PASSWORD}");
assertThat(security.getUser().isDefaultPassword()).isTrue(); assertThat(security.getUser().isDefaultPassword()).isTrue();
} }
@Test @Test
public void testDefaultPasswordAutoGeneratedIfEmpty() { public void testDefaultPasswordAutoGeneratedIfEmpty() {
SimpleAuthenticationProperties security = load(SimpleAuthenticationProperties.class, SimpleAuthenticationProperties security = load(
SimpleAuthenticationProperties.class,
"management.shell.auth.simple.user.password="); "management.shell.auth.simple.user.password=");
assertThat(security.getUser().isDefaultPassword()).isTrue(); assertThat(security.getUser().isDefaultPassword()).isTrue();
} }
...@@ -242,9 +244,9 @@ public class ShellPropertiesTests { ...@@ -242,9 +244,9 @@ public class ShellPropertiesTests {
} }
@Configuration @Configuration
@EnableConfigurationProperties({ShellProperties.class, @EnableConfigurationProperties({ ShellProperties.class,
JaasAuthenticationProperties.class, KeyAuthenticationProperties.class, JaasAuthenticationProperties.class, KeyAuthenticationProperties.class,
SimpleAuthenticationProperties.class, SpringAuthenticationProperties.class}) SimpleAuthenticationProperties.class, SpringAuthenticationProperties.class })
static class TestConfiguration { static class TestConfiguration {
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.ws; package org.springframework.boot.autoconfigure.webservices;
import java.util.Map; import java.util.Map;
...@@ -44,13 +44,13 @@ import org.springframework.ws.transport.http.MessageDispatcherServlet; ...@@ -44,13 +44,13 @@ import org.springframework.ws.transport.http.MessageDispatcherServlet;
@ConditionalOnWebApplication @ConditionalOnWebApplication
@ConditionalOnClass(MessageDispatcherServlet.class) @ConditionalOnClass(MessageDispatcherServlet.class)
@ConditionalOnMissingBean(WsConfigurationSupport.class) @ConditionalOnMissingBean(WsConfigurationSupport.class)
@EnableConfigurationProperties(WsProperties.class) @EnableConfigurationProperties(WebServicesProperties.class)
@AutoConfigureAfter(EmbeddedServletContainerAutoConfiguration.class) @AutoConfigureAfter(EmbeddedServletContainerAutoConfiguration.class)
public class WsAutoConfiguration { public class WebServicesAutoConfiguration {
private final WsProperties properties; private final WebServicesProperties properties;
public WsAutoConfiguration(WsProperties properties) { public WebServicesAutoConfiguration(WebServicesProperties properties) {
this.properties = properties; this.properties = properties;
} }
...@@ -61,9 +61,9 @@ public class WsAutoConfiguration { ...@@ -61,9 +61,9 @@ public class WsAutoConfiguration {
servlet.setApplicationContext(applicationContext); servlet.setApplicationContext(applicationContext);
String path = this.properties.getPath(); String path = this.properties.getPath();
String urlMapping = (path.endsWith("/") ? path + "*" : path + "/*"); String urlMapping = (path.endsWith("/") ? path + "*" : path + "/*");
ServletRegistrationBean registration = new ServletRegistrationBean( ServletRegistrationBean registration = new ServletRegistrationBean(servlet,
servlet, urlMapping); urlMapping);
WsProperties.Servlet servletProperties = this.properties.getServlet(); WebServicesProperties.Servlet servletProperties = this.properties.getServlet();
registration.setLoadOnStartup(servletProperties.getLoadOnStartup()); registration.setLoadOnStartup(servletProperties.getLoadOnStartup());
for (Map.Entry<String, String> entry : servletProperties.getInit().entrySet()) { for (Map.Entry<String, String> entry : servletProperties.getInit().entrySet()) {
registration.addInitParameter(entry.getKey(), entry.getValue()); registration.addInitParameter(entry.getKey(), entry.getValue());
...@@ -74,6 +74,7 @@ public class WsAutoConfiguration { ...@@ -74,6 +74,7 @@ public class WsAutoConfiguration {
@Configuration @Configuration
@EnableWs @EnableWs
protected static class WsConfiguration { protected static class WsConfiguration {
} }
} }
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.ws; package org.springframework.boot.autoconfigure.webservices;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
...@@ -31,8 +31,8 @@ import org.springframework.boot.context.properties.ConfigurationProperties; ...@@ -31,8 +31,8 @@ import org.springframework.boot.context.properties.ConfigurationProperties;
* @author Stephane Nicoll * @author Stephane Nicoll
* @since 1.4.0 * @since 1.4.0
*/ */
@ConfigurationProperties("spring.ws") @ConfigurationProperties("spring.webservices")
public class WsProperties { public class WebServicesProperties {
/** /**
* Path that serves as the base URI for the services. * Path that serves as the base URI for the services.
...@@ -55,7 +55,6 @@ public class WsProperties { ...@@ -55,7 +55,6 @@ public class WsProperties {
return this.servlet; return this.servlet;
} }
public static class Servlet { public static class Servlet {
/** /**
......
...@@ -17,4 +17,4 @@ ...@@ -17,4 +17,4 @@
/** /**
* Auto-configuration for Spring Web Services. * Auto-configuration for Spring Web Services.
*/ */
package org.springframework.boot.autoconfigure.ws; package org.springframework.boot.autoconfigure.webservices;
...@@ -97,7 +97,7 @@ org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration,\ ...@@ -97,7 +97,7 @@ org.springframework.boot.autoconfigure.web.ServerPropertiesAutoConfiguration,\
org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration,\ org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration,\
org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration,\ org.springframework.boot.autoconfigure.websocket.WebSocketAutoConfiguration,\
org.springframework.boot.autoconfigure.websocket.WebSocketMessagingAutoConfiguration,\ org.springframework.boot.autoconfigure.websocket.WebSocketMessagingAutoConfiguration,\
org.springframework.boot.autoconfigure.ws.WsAutoConfiguration org.springframework.boot.autoconfigure.webservices.WebServicesAutoConfiguration
# Template availability providers # Template availability providers
org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider=\ org.springframework.boot.autoconfigure.template.TemplateAvailabilityProvider=\
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package org.springframework.boot.autoconfigure.ws; package org.springframework.boot.autoconfigure.webservices;
import org.junit.After; import org.junit.After;
import org.junit.Rule; import org.junit.Rule;
...@@ -31,12 +31,12 @@ import org.springframework.web.context.support.AnnotationConfigWebApplicationCon ...@@ -31,12 +31,12 @@ import org.springframework.web.context.support.AnnotationConfigWebApplicationCon
import static org.assertj.core.api.Assertions.assertThat; import static org.assertj.core.api.Assertions.assertThat;
/** /**
* Tests for {@link WsAutoConfiguration}. * Tests for {@link WebServicesAutoConfiguration}.
* *
* @author Vedran Pavic * @author Vedran Pavic
* @author Stephane Nicoll * @author Stephane Nicoll
*/ */
public class WsAutoConfigurationTests { public class WebServicesAutoConfigurationTests {
@Rule @Rule
public ExpectedException thrown = ExpectedException.none(); public ExpectedException thrown = ExpectedException.none();
...@@ -52,8 +52,7 @@ public class WsAutoConfigurationTests { ...@@ -52,8 +52,7 @@ public class WsAutoConfigurationTests {
@Test @Test
public void defaultConfiguration() { public void defaultConfiguration() {
load(WsAutoConfiguration.class); load(WebServicesAutoConfiguration.class);
assertThat(this.context.getBeansOfType(ServletRegistrationBean.class)).hasSize(1); assertThat(this.context.getBeansOfType(ServletRegistrationBean.class)).hasSize(1);
} }
...@@ -61,19 +60,19 @@ public class WsAutoConfigurationTests { ...@@ -61,19 +60,19 @@ public class WsAutoConfigurationTests {
public void customPathMustBeginWithASlash() { public void customPathMustBeginWithASlash() {
this.thrown.expect(BeanCreationException.class); this.thrown.expect(BeanCreationException.class);
this.thrown.expectMessage("Path must start with /"); this.thrown.expectMessage("Path must start with /");
load(WsAutoConfiguration.class, "spring.ws.path=invalid"); load(WebServicesAutoConfiguration.class, "spring.webservices.path=invalid");
} }
@Test @Test
public void customPathWithTrailingSlash() { public void customPathWithTrailingSlash() {
load(WsAutoConfiguration.class, "spring.ws.path=/valid/"); load(WebServicesAutoConfiguration.class, "spring.webservices.path=/valid/");
assertThat(this.context.getBean(ServletRegistrationBean.class).getUrlMappings()) assertThat(this.context.getBean(ServletRegistrationBean.class).getUrlMappings())
.contains("/valid/*"); .contains("/valid/*");
} }
@Test @Test
public void customPath() { public void customPath() {
load(WsAutoConfiguration.class, "spring.ws.path=/valid"); load(WebServicesAutoConfiguration.class, "spring.webservices.path=/valid");
assertThat(this.context.getBeansOfType(ServletRegistrationBean.class)).hasSize(1); assertThat(this.context.getBeansOfType(ServletRegistrationBean.class)).hasSize(1);
assertThat(this.context.getBean(ServletRegistrationBean.class).getUrlMappings()) assertThat(this.context.getBean(ServletRegistrationBean.class).getUrlMappings())
.contains("/valid/*"); .contains("/valid/*");
...@@ -81,7 +80,8 @@ public class WsAutoConfigurationTests { ...@@ -81,7 +80,8 @@ public class WsAutoConfigurationTests {
@Test @Test
public void customLoadOnStartup() { public void customLoadOnStartup() {
load(WsAutoConfiguration.class, "spring.ws.servlet.load-on-startup=1"); load(WebServicesAutoConfiguration.class,
"spring.webservices.servlet.load-on-startup=1");
ServletRegistrationBean registrationBean = this.context ServletRegistrationBean registrationBean = this.context
.getBean(ServletRegistrationBean.class); .getBean(ServletRegistrationBean.class);
assertThat(ReflectionTestUtils.getField(registrationBean, "loadOnStartup")) assertThat(ReflectionTestUtils.getField(registrationBean, "loadOnStartup"))
...@@ -90,8 +90,9 @@ public class WsAutoConfigurationTests { ...@@ -90,8 +90,9 @@ public class WsAutoConfigurationTests {
@Test @Test
public void customInitParameters() { public void customInitParameters() {
load(WsAutoConfiguration.class, "spring.ws.servlet.init.key1=value1", load(WebServicesAutoConfiguration.class,
"spring.ws.servlet.init.key2=value2"); "spring.webservices.servlet.init.key1=value1",
"spring.webservices.servlet.init.key2=value2");
ServletRegistrationBean registrationBean = this.context ServletRegistrationBean registrationBean = this.context
.getBean(ServletRegistrationBean.class); .getBean(ServletRegistrationBean.class);
assertThat(registrationBean.getInitParameters()).containsEntry("key1", "value1"); assertThat(registrationBean.getInitParameters()).containsEntry("key1", "value1");
...@@ -99,12 +100,12 @@ public class WsAutoConfigurationTests { ...@@ -99,12 +100,12 @@ public class WsAutoConfigurationTests {
} }
private void load(Class<?> config, String... environment) { private void load(Class<?> config, String... environment) {
AnnotationConfigWebApplicationContext ctx = new AnnotationConfigWebApplicationContext(); AnnotationConfigWebApplicationContext context = new AnnotationConfigWebApplicationContext();
ctx.setServletContext(new MockServletContext()); context.setServletContext(new MockServletContext());
EnvironmentTestUtils.addEnvironment(ctx, environment); EnvironmentTestUtils.addEnvironment(context, environment);
ctx.register(config); context.register(config);
ctx.refresh(); context.refresh();
this.context = ctx; this.context = context;
} }
} }
...@@ -160,7 +160,7 @@ ...@@ -160,7 +160,7 @@
<spring-social-facebook.version>2.0.3.RELEASE</spring-social-facebook.version> <spring-social-facebook.version>2.0.3.RELEASE</spring-social-facebook.version>
<spring-social-linkedin.version>1.0.2.RELEASE</spring-social-linkedin.version> <spring-social-linkedin.version>1.0.2.RELEASE</spring-social-linkedin.version>
<spring-social-twitter.version>1.1.2.RELEASE</spring-social-twitter.version> <spring-social-twitter.version>1.1.2.RELEASE</spring-social-twitter.version>
<spring-ws.version>2.3.0.RELEASE</spring-ws.version> <spring-webservices.version>2.3.0.RELEASE</spring-webservices.version>
<sqlite-jdbc.version>3.8.11.2</sqlite-jdbc.version> <sqlite-jdbc.version>3.8.11.2</sqlite-jdbc.version>
<statsd-client.version>3.1.0</statsd-client.version> <statsd-client.version>3.1.0</statsd-client.version>
<sun-mail.version>${javax-mail.version}</sun-mail.version> <sun-mail.version>${javax-mail.version}</sun-mail.version>
...@@ -505,7 +505,7 @@ ...@@ -505,7 +505,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-ws</artifactId> <artifactId>spring-boot-starter-webservices</artifactId>
<version>1.4.0.BUILD-SNAPSHOT</version> <version>1.4.0.BUILD-SNAPSHOT</version>
</dependency> </dependency>
...@@ -2179,7 +2179,7 @@ ...@@ -2179,7 +2179,7 @@
<dependency> <dependency>
<groupId>org.springframework.ws</groupId> <groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-core</artifactId> <artifactId>spring-ws-core</artifactId>
<version>${spring-ws.version}</version> <version>${spring-webservices.version}</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>commons-logging</groupId> <groupId>commons-logging</groupId>
...@@ -2190,7 +2190,7 @@ ...@@ -2190,7 +2190,7 @@
<dependency> <dependency>
<groupId>org.springframework.ws</groupId> <groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-security</artifactId> <artifactId>spring-ws-security</artifactId>
<version>${spring-ws.version}</version> <version>${spring-webservices.version}</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>commons-logging</groupId> <groupId>commons-logging</groupId>
...@@ -2201,7 +2201,7 @@ ...@@ -2201,7 +2201,7 @@
<dependency> <dependency>
<groupId>org.springframework.ws</groupId> <groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-support</artifactId> <artifactId>spring-ws-support</artifactId>
<version>${spring-ws.version}</version> <version>${spring-webservices.version}</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>commons-logging</groupId> <groupId>commons-logging</groupId>
...@@ -2212,7 +2212,7 @@ ...@@ -2212,7 +2212,7 @@
<dependency> <dependency>
<groupId>org.springframework.ws</groupId> <groupId>org.springframework.ws</groupId>
<artifactId>spring-ws-test</artifactId> <artifactId>spring-ws-test</artifactId>
<version>${spring-ws.version}</version> <version>${spring-webservices.version}</version>
<exclusions> <exclusions>
<exclusion> <exclusion>
<groupId>commons-logging</groupId> <groupId>commons-logging</groupId>
......
...@@ -406,10 +406,10 @@ content into your application; rather pick only the properties that you need. ...@@ -406,10 +406,10 @@ content into your application; rather pick only the properties that you need.
spring.velocity.toolbox-config-location= # Velocity Toolbox config location. For instance `/WEB-INF/toolbox.xml` spring.velocity.toolbox-config-location= # Velocity Toolbox config location. For instance `/WEB-INF/toolbox.xml`
spring.velocity.view-names= # White list of view names that can be resolved. spring.velocity.view-names= # White list of view names that can be resolved.
# WEB SERVICES ({sc-spring-boot-autoconfigure}/ws/WsProperties.{sc-ext}[WsProperties]) # WEB SERVICES ({sc-spring-boot-autoconfigure}/webservices/WebServicesProperties.{sc-ext}[WebServicesProperties])
spring.ws.path=/services # Path that serves as the base URI for the services. spring.webservices.path=/services # Path that serves as the base URI for the services.
spring.ws.servlet.init= # Servlet init parameters to pass to Spring Web Services. spring.webservices.servlet.init= # Servlet init parameters to pass to Spring Web Services.
spring.ws.servlet.load-on-startup=-1 # Load on startup priority of the Spring Web Services servlet. spring.webservices.servlet.load-on-startup=-1 # Load on startup priority of the Spring Web Services servlet.
[[common-application-properties-security]] [[common-application-properties-security]]
......
...@@ -37,7 +37,7 @@ Phillip Webb; Dave Syer; Josh Long; Stéphane Nicoll; Rob Winch; Andy Wilkinson; ...@@ -37,7 +37,7 @@ Phillip Webb; Dave Syer; Josh Long; Stéphane Nicoll; Rob Winch; Andy Wilkinson;
:spring-boot-maven-plugin-site: http://docs.spring.io/spring-boot/docs/{spring-boot-docs-version}/maven-plugin :spring-boot-maven-plugin-site: http://docs.spring.io/spring-boot/docs/{spring-boot-docs-version}/maven-plugin
:spring-reference: http://docs.spring.io/spring/docs/{spring-docs-version}/spring-framework-reference/htmlsingle :spring-reference: http://docs.spring.io/spring/docs/{spring-docs-version}/spring-framework-reference/htmlsingle
:spring-security-reference: http://docs.spring.io/spring-security/site/docs/{spring-security-docs-version}/reference/htmlsingle :spring-security-reference: http://docs.spring.io/spring-security/site/docs/{spring-security-docs-version}/reference/htmlsingle
:spring-ws-reference: http://docs.spring.io/spring-ws/docs/{spring-ws-docs-version}/reference/htmlsingle :spring-webservices-reference: http://docs.spring.io/spring-ws/docs/{spring-webservices-docs-version}/reference/htmlsingle
:spring-javadoc: http://docs.spring.io/spring/docs/{spring-docs-version}/javadoc-api/org/springframework :spring-javadoc: http://docs.spring.io/spring/docs/{spring-docs-version}/javadoc-api/org/springframework
:spring-amqp-javadoc: http://docs.spring.io/spring-amqp/docs/current/api/org/springframework/amqp :spring-amqp-javadoc: http://docs.spring.io/spring-amqp/docs/current/api/org/springframework/amqp
:spring-data-javadoc: http://docs.spring.io/spring-data/jpa/docs/current/api/org/springframework/data/jpa :spring-data-javadoc: http://docs.spring.io/spring-data/jpa/docs/current/api/org/springframework/data/jpa
......
...@@ -5002,13 +5002,13 @@ be easily accessed via the `spring-boot-starter-websocket` module. ...@@ -5002,13 +5002,13 @@ be easily accessed via the `spring-boot-starter-websocket` module.
[[boot-features-ws]] [[boot-features-webservices]]
== Web Services == Web Services
Spring Boot provides Web Services auto-configuration so that all is required is defining Spring Boot provides Web Services auto-configuration so that all is required is defining
your `Endpoints`. your `Endpoints`.
The {spring-ws-reference}[Spring Web Services features] can be easily accessed via the The {spring-webservices-reference}[Spring Web Services features] can be easily accessed
`spring-boot-starter-ws` module. via the `spring-boot-starter-webservices` module.
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
<module>spring-boot-sample-websocket-jetty</module> <module>spring-boot-sample-websocket-jetty</module>
<module>spring-boot-sample-websocket-tomcat</module> <module>spring-boot-sample-websocket-tomcat</module>
<module>spring-boot-sample-websocket-undertow</module> <module>spring-boot-sample-websocket-undertow</module>
<module>spring-boot-sample-ws</module> <module>spring-boot-sample-webservices</module>
<module>spring-boot-sample-xml</module> <module>spring-boot-sample-xml</module>
</modules> </modules>
<!-- No dependencies - otherwise the samples won't work if you change the <!-- No dependencies - otherwise the samples won't work if you change the
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<version>1.4.0.BUILD-SNAPSHOT</version> <version>1.4.0.BUILD-SNAPSHOT</version>
</parent> </parent>
<artifactId>spring-boot-sample-ws</artifactId> <artifactId>spring-boot-sample-webservices</artifactId>
<name>Spring Boot Web Services Sample</name> <name>Spring Boot Web Services Sample</name>
<description>Spring Boot Web Services Sample</description> <description>Spring Boot Web Services Sample</description>
<url>http://projects.spring.io/spring-boot/</url> <url>http://projects.spring.io/spring-boot/</url>
...@@ -26,7 +26,7 @@ ...@@ -26,7 +26,7 @@
</dependency> </dependency>
<dependency> <dependency>
<groupId>org.springframework.boot</groupId> <groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-ws</artifactId> <artifactId>spring-boot-starter-webservices</artifactId>
</dependency> </dependency>
<dependency> <dependency>
<groupId>jaxen</groupId> <groupId>jaxen</groupId>
......
...@@ -14,16 +14,16 @@ ...@@ -14,16 +14,16 @@
* limitations under the License. * limitations under the License.
*/ */
package sample.ws; package sample.webservices;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication @SpringBootApplication
public class SampleWsApplication { public class SampleWebServicesApplication {
public static void main(String[] args) throws Exception { public static void main(String[] args) throws Exception {
SpringApplication.run(SampleWsApplication.class, args); SpringApplication.run(SampleWebServicesApplication.class, args);
} }
} }
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package sample.ws; package sample.webservices;
import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
...@@ -29,12 +29,12 @@ public class WebServiceConfig extends WsConfigurerAdapter { ...@@ -29,12 +29,12 @@ public class WebServiceConfig extends WsConfigurerAdapter {
@Bean(name = "holiday") @Bean(name = "holiday")
public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema countriesSchema) { public DefaultWsdl11Definition defaultWsdl11Definition(XsdSchema countriesSchema) {
DefaultWsdl11Definition wsdl11Definition = new DefaultWsdl11Definition(); DefaultWsdl11Definition wsdl = new DefaultWsdl11Definition();
wsdl11Definition.setPortTypeName("HumanResource"); wsdl.setPortTypeName("HumanResource");
wsdl11Definition.setLocationUri("/holidayService/"); wsdl.setLocationUri("/holidayService/");
wsdl11Definition.setTargetNamespace("http://mycompany.com/hr/definitions"); wsdl.setTargetNamespace("http://mycompany.com/hr/definitions");
wsdl11Definition.setSchema(countriesSchema); wsdl.setSchema(countriesSchema);
return wsdl11Definition; return wsdl;
} }
@Bean @Bean
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package sample.ws.endpoint; package sample.webservices.endpoint;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
...@@ -28,7 +28,7 @@ import org.jdom2.Namespace; ...@@ -28,7 +28,7 @@ import org.jdom2.Namespace;
import org.jdom2.filter.Filters; import org.jdom2.filter.Filters;
import org.jdom2.xpath.XPathExpression; import org.jdom2.xpath.XPathExpression;
import org.jdom2.xpath.XPathFactory; import org.jdom2.xpath.XPathFactory;
import sample.ws.service.HumanResourceService; import sample.webservices.service.HumanResourceService;
import org.springframework.ws.server.endpoint.annotation.Endpoint; import org.springframework.ws.server.endpoint.annotation.Endpoint;
import org.springframework.ws.server.endpoint.annotation.PayloadRoot; import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
...@@ -40,7 +40,9 @@ public class HolidayEndpoint { ...@@ -40,7 +40,9 @@ public class HolidayEndpoint {
private static final String NAMESPACE_URI = "http://mycompany.com/hr/schemas"; private static final String NAMESPACE_URI = "http://mycompany.com/hr/schemas";
private XPathExpression<Element> startDateExpression; private XPathExpression<Element> startDateExpression;
private XPathExpression<Element> endDateExpression; private XPathExpression<Element> endDateExpression;
private XPathExpression<String> nameExpression; private XPathExpression<String> nameExpression;
private HumanResourceService humanResourceService; private HumanResourceService humanResourceService;
...@@ -49,11 +51,8 @@ public class HolidayEndpoint { ...@@ -49,11 +51,8 @@ public class HolidayEndpoint {
throws JDOMException, XPathFactoryConfigurationException, throws JDOMException, XPathFactoryConfigurationException,
XPathExpressionException { XPathExpressionException {
this.humanResourceService = humanResourceService; this.humanResourceService = humanResourceService;
Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI); Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI);
XPathFactory xPathFactory = XPathFactory.instance(); XPathFactory xPathFactory = XPathFactory.instance();
this.startDateExpression = xPathFactory.compile("//hr:StartDate", this.startDateExpression = xPathFactory.compile("//hr:StartDate",
Filters.element(), null, namespace); Filters.element(), null, namespace);
this.endDateExpression = xPathFactory.compile("//hr:EndDate", Filters.element(), this.endDateExpression = xPathFactory.compile("//hr:EndDate", Filters.element(),
...@@ -72,7 +71,6 @@ public class HolidayEndpoint { ...@@ -72,7 +71,6 @@ public class HolidayEndpoint {
Date endDate = dateFormat Date endDate = dateFormat
.parse(this.endDateExpression.evaluateFirst(holidayRequest).getText()); .parse(this.endDateExpression.evaluateFirst(holidayRequest).getText());
String name = this.nameExpression.evaluateFirst(holidayRequest); String name = this.nameExpression.evaluateFirst(holidayRequest);
this.humanResourceService.bookHoliday(startDate, endDate, name); this.humanResourceService.bookHoliday(startDate, endDate, name);
} }
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package sample.ws.service; package sample.webservices.service;
import java.util.Date; import java.util.Date;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package sample.ws.service; package sample.webservices.service;
import java.util.Date; import java.util.Date;
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
* limitations under the License. * limitations under the License.
*/ */
package sample.ws; package sample.webservices;
import java.io.StringReader; import java.io.StringReader;
...@@ -62,10 +62,8 @@ public class SampleWsApplicationTests { ...@@ -62,10 +62,8 @@ public class SampleWsApplicationTests {
+ " <hr:FirstName>John</hr:FirstName>" + " <hr:FirstName>John</hr:FirstName>"
+ " <hr:LastName>Doe</hr:LastName>" + " </hr:Employee>" + " <hr:LastName>Doe</hr:LastName>" + " </hr:Employee>"
+ "</hr:HolidayRequest>"; + "</hr:HolidayRequest>";
StreamSource source = new StreamSource(new StringReader(request)); StreamSource source = new StreamSource(new StringReader(request));
StreamResult result = new StreamResult(System.out); StreamResult result = new StreamResult(System.out);
this.webServiceTemplate.sendSourceAndReceiveToResult(source, result); this.webServiceTemplate.sendSourceAndReceiveToResult(source, result);
assertThat(this.output.toString()).contains("Booking holiday for"); assertThat(this.output.toString()).contains("Booking holiday for");
} }
......
...@@ -69,7 +69,7 @@ ...@@ -69,7 +69,7 @@
<module>spring-boot-starter-velocity</module> <module>spring-boot-starter-velocity</module>
<module>spring-boot-starter-web</module> <module>spring-boot-starter-web</module>
<module>spring-boot-starter-websocket</module> <module>spring-boot-starter-websocket</module>
<module>spring-boot-starter-ws</module> <module>spring-boot-starter-webservices</module>
</modules> </modules>
<build> <build>
......
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
<artifactId>spring-boot-starters</artifactId> <artifactId>spring-boot-starters</artifactId>
<version>1.4.0.BUILD-SNAPSHOT</version> <version>1.4.0.BUILD-SNAPSHOT</version>
</parent> </parent>
<artifactId>spring-boot-starter-ws</artifactId> <artifactId>spring-boot-starter-webservices</artifactId>
<name>Spring Boot Web Services Starter</name> <name>Spring Boot Web Services Starter</name>
<description>Starter for using Spring Web Services</description> <description>Starter for using Spring Web Services</description>
<url>http://projects.spring.io/spring-boot/</url> <url>http://projects.spring.io/spring-boot/</url>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment