Skip to content

Commit 15de653

Browse files
committed
Polish "Add support for Spring WS auto WSDL/XSD exposure"
Closes gh-9635
1 parent bb72a4a commit 15de653

File tree

2 files changed

+24
-19
lines changed

2 files changed

+24
-19
lines changed

spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/webservices/WebServicesAutoConfiguration.java

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,11 @@ private static class WsdlDefinitionBeanFactoryPostProcessor
106106

107107
private ApplicationContext applicationContext;
108108

109+
@Override
110+
public void setApplicationContext(ApplicationContext applicationContext) {
111+
this.applicationContext = applicationContext;
112+
}
113+
109114
@Override
110115
public void postProcessBeanDefinitionRegistry(BeanDefinitionRegistry registry)
111116
throws BeansException {
@@ -125,33 +130,29 @@ public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory)
125130
throws BeansException {
126131
}
127132

128-
@Override
129-
public void setApplicationContext(ApplicationContext applicationContext)
130-
throws BeansException {
131-
this.applicationContext = applicationContext;
132-
}
133-
134133
private void registerBeans(String location, String pattern, Class<?> type,
135134
BeanDefinitionRegistry registry) {
136-
Resource[] resources = new Resource[] {};
137-
try {
138-
resources = this.applicationContext
139-
.getResources(ensureTrailingSlash(location) + pattern);
140-
}
141-
catch (IOException ignored) {
142-
}
143-
for (Resource resource : resources) {
135+
for (Resource resource : getResources(location, pattern)) {
144136
RootBeanDefinition beanDefinition = new RootBeanDefinition(type);
145137
ConstructorArgumentValues constructorArguments = new ConstructorArgumentValues();
146138
constructorArguments.addIndexedArgumentValue(0, resource);
147139
beanDefinition.setConstructorArgumentValues(constructorArguments);
148-
149140
registry.registerBeanDefinition(
150141
StringUtils.stripFilenameExtension(resource.getFilename()),
151142
beanDefinition);
152143
}
153144
}
154145

146+
private Resource[] getResources(String location, String pattern) {
147+
try {
148+
return this.applicationContext
149+
.getResources(ensureTrailingSlash(location) + pattern);
150+
}
151+
catch (IOException e) {
152+
return new Resource[0];
153+
}
154+
}
155+
155156
private static String ensureTrailingSlash(String path) {
156157
if (!path.endsWith("/")) {
157158
return path + "/";

spring-boot-docs/src/main/asciidoc/spring-boot-features.adoc

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6560,10 +6560,14 @@ your `Endpoints`.
65606560
The {spring-webservices-reference}[Spring Web Services features] can be easily accessed
65616561
via the `spring-boot-starter-webservices` module.
65626562

6563-
Spring Boot can also automatically expose your WSDLs and XSDs using
6564-
`spring.webservices.wsdl-locations` configuration property. For the detected WSDL and XSD
6565-
files Boot will register beans of type `SimpleWsdl11Definition` and `SimpleXsdSchema`,
6566-
respectively.
6563+
`SimpleWsdl11Definition` and `SimpleXsdSchema` beans can be automatically created for your
6564+
WSDLs and XSDs respectively. To do so, configure their location:
6565+
6566+
6567+
[source,properties,indent=0]
6568+
----
6569+
spring.webservices.wsdl-locations=classpath:/wsdl
6570+
----
65676571

65686572

65696573

0 commit comments

Comments
 (0)