diff --git a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/webservices/WebServicesAutoConfiguration.java b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/webservices/WebServicesAutoConfiguration.java index 26635733b3b..f4660fa738a 100644 --- a/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/webservices/WebServicesAutoConfiguration.java +++ b/spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/webservices/WebServicesAutoConfiguration.java @@ -106,6 +106,11 @@ public class WebServicesAutoConfiguration { private ApplicationContext applicationContext; + @Override + public void setApplicationContext(ApplicationContext applicationContext) { + this.applicationContext = applicationContext; + } + @Override public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry) throws BeansException { @@ -125,33 +130,29 @@ public class WebServicesAutoConfiguration { throws BeansException { } - @Override - public void setApplicationContext(ApplicationContext applicationContext) - throws BeansException { - this.applicationContext = applicationContext; - } - private void registerBeans(String location, String pattern, Class type, BeanDefinitionRegistry registry) { - Resource[] resources = new Resource[] {}; - try { - resources = this.applicationContext - .getResources(ensureTrailingSlash(location) + pattern); - } - catch (IOException ignored) { - } - for (Resource resource : resources) { + for (Resource resource : getResources(location, pattern)) { RootBeanDefinition beanDefinition = new RootBeanDefinition(type); ConstructorArgumentValues constructorArguments = new ConstructorArgumentValues(); constructorArguments.addIndexedArgumentValue(0, resource); beanDefinition.setConstructorArgumentValues(constructorArguments); - registry.registerBeanDefinition( StringUtils.stripFilenameExtension(resource.getFilename()), beanDefinition); } } + private Resource[] getResources(String location, String pattern) { + try { + return this.applicationContext + .getResources(ensureTrailingSlash(location) + pattern); + } + catch (IOException e) { + return new Resource[0]; + } + } + private static String ensureTrailingSlash(String path) { if (!path.endsWith("/")) { return path + "/"; diff --git a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc index d912afd140e..7186bc52569 100644 --- a/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc +++ b/spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc @@ -6560,10 +6560,14 @@ your `Endpoints`. The {spring-webservices-reference}[Spring Web Services features] can be easily accessed via the `spring-boot-starter-webservices` module. -Spring Boot can also automatically expose your WSDLs and XSDs using -`spring.webservices.wsdl-locations` configuration property. For the detected WSDL and XSD -files Boot will register beans of type `SimpleWsdl11Definition` and `SimpleXsdSchema`, -respectively. +`SimpleWsdl11Definition` and `SimpleXsdSchema` beans can be automatically created for your +WSDLs and XSDs respectively. To do so, configure their location: + + +[source,properties,indent=0] +---- + spring.webservices.wsdl-locations=classpath:/wsdl +----