Skip to content

Commit b585afe

Browse files
committed
Polishing
1 parent e40320a commit b585afe

File tree

16 files changed

+247
-158
lines changed

16 files changed

+247
-158
lines changed

spring-boot-dependencies/pom.xml

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
<jetty.version>8.1.15.v20140411</jetty.version>
8181
<jetty-jsp.version>2.2.0.v201112011158</jetty-jsp.version>
8282
<jaxen.version>1.1.6</jaxen.version>
83-
<jdom.version>2.0.1</jdom.version>
83+
<jdom2.version>2.0.5</jdom2.version>
8484
<joda-time.version>2.3</joda-time.version>
8585
<jolokia.version>1.2.1</jolokia.version>
8686
<jstl.version>1.2</jstl.version>
@@ -118,6 +118,7 @@
118118
<tomcat.version>7.0.54</tomcat.version>
119119
<velocity.version>1.7</velocity.version>
120120
<velocity-tools.version>2.0</velocity-tools.version>
121+
<wsdl4j.version>1.6.1</wsdl4j.version>
121122
</properties>
122123
<prerequisites>
123124
<maven>3.0.0</maven>
@@ -834,8 +835,8 @@
834835
</dependency>
835836
<dependency>
836837
<groupId>org.jdom</groupId>
837-
<artifactId>jdom</artifactId>
838-
<version>${jdom.version}</version>
838+
<artifactId>jdom2</artifactId>
839+
<version>${jdom2.version}</version>
839840
</dependency>
840841
<dependency>
841842
<groupId>org.liquibase</groupId>
@@ -1066,6 +1067,26 @@
10661067
<artifactId>spring-social-web</artifactId>
10671068
<version>${spring-social.version}</version>
10681069
</dependency>
1070+
<dependency>
1071+
<groupId>org.springframework.social</groupId>
1072+
<artifactId>spring-social-facebook</artifactId>
1073+
<version>${spring-social-facebook.version}</version>
1074+
</dependency>
1075+
<dependency>
1076+
<groupId>org.springframework.social</groupId>
1077+
<artifactId>spring-social-facebook-web</artifactId>
1078+
<version>${spring-social-facebook.version}</version>
1079+
</dependency>
1080+
<dependency>
1081+
<groupId>org.springframework.social</groupId>
1082+
<artifactId>spring-social-linkedin</artifactId>
1083+
<version>${spring-social-linkedin.version}</version>
1084+
</dependency>
1085+
<dependency>
1086+
<groupId>org.springframework.social</groupId>
1087+
<artifactId>spring-social-twitter</artifactId>
1088+
<version>${spring-social-twitter.version}</version>
1089+
</dependency>
10691090
<dependency>
10701091
<groupId>org.springframework.ws</groupId>
10711092
<artifactId>spring-ws-core</artifactId>
@@ -1110,16 +1131,6 @@
11101131
</exclusion>
11111132
</exclusions>
11121133
</dependency>
1113-
<dependency>
1114-
<groupId>wsdl4j</groupId>
1115-
<artifactId>wsdl4j</artifactId>
1116-
<version>1.6.3</version>
1117-
</dependency>
1118-
<dependency>
1119-
<groupId>xmlunit</groupId>
1120-
<artifactId>xmlunit</artifactId>
1121-
<version>1.5</version>
1122-
</dependency>
11231134
<dependency>
11241135
<groupId>org.thymeleaf</groupId>
11251136
<artifactId>thymeleaf</artifactId>
@@ -1135,26 +1146,6 @@
11351146
<artifactId>thymeleaf-extras-springsecurity3</artifactId>
11361147
<version>${thymeleaf-extras-springsecurity3.version}</version>
11371148
</dependency>
1138-
<dependency>
1139-
<groupId>org.springframework.social</groupId>
1140-
<artifactId>spring-social-facebook</artifactId>
1141-
<version>${spring-social-facebook.version}</version>
1142-
</dependency>
1143-
<dependency>
1144-
<groupId>org.springframework.social</groupId>
1145-
<artifactId>spring-social-facebook-web</artifactId>
1146-
<version>${spring-social-facebook.version}</version>
1147-
</dependency>
1148-
<dependency>
1149-
<groupId>org.springframework.social</groupId>
1150-
<artifactId>spring-social-twitter</artifactId>
1151-
<version>${spring-social-twitter.version}</version>
1152-
</dependency>
1153-
<dependency>
1154-
<groupId>org.springframework.social</groupId>
1155-
<artifactId>spring-social-linkedin</artifactId>
1156-
<version>${spring-social-linkedin.version}</version>
1157-
</dependency>
11581149
<dependency>
11591150
<groupId>org.yaml</groupId>
11601151
<artifactId>snakeyaml</artifactId>
@@ -1165,6 +1156,11 @@
11651156
<artifactId>jedis</artifactId>
11661157
<version>${jedis.version}</version>
11671158
</dependency>
1159+
<dependency>
1160+
<groupId>wsdl4j</groupId>
1161+
<artifactId>wsdl4j</artifactId>
1162+
<version>${wsdl4j.version}</version>
1163+
</dependency>
11681164
</dependencies>
11691165
</dependencyManagement>
11701166
<build>

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -289,6 +289,10 @@ and Hibernate.
289289
|Support for websocket development with Tomcat.
290290
|===
291291

292+
|`spring-boot-starter-ws`
293+
|Support for Spring Web Services
294+
|===
295+
292296
In addition to the application starters, the following starters can be used to
293297
add '<<production-ready-features.adoc#production-ready, production ready>>' features.
294298

spring-boot-samples/pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@
5656
<module>spring-boot-sample-web-ui</module>
5757
<module>spring-boot-sample-web-velocity</module>
5858
<module>spring-boot-sample-websocket</module>
59+
<module>spring-boot-sample-ws</module>
5960
<module>spring-boot-sample-xml</module>
60-
<module>spring-boot-sample-ws</module>
6161
</modules>
6262
<!-- No dependencies - otherwise the samples won't work if you change the
6363
parent -->
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
== Spring Boot - Samples - Web Services
2+
3+
This sample project demonstrates how to use http://projects.spring.io/spring-ws/[Spring Web Services]
4+
with Spring Boot. It is an implementation of the
5+
http://docs.spring.io/spring-ws/site/reference/html/tutorial.html#tutorial.implementing.endpoint[Holiday Request sample]
6+
in the Spring Web Services reference guilde.
7+
8+
The sample uses Maven. It can be built and run from the command line:
9+
10+
----
11+
$ mvn spring-boot:run
12+
----
13+
14+
http://localhost:8080/services/holidayService/holiday.wsdl will now display the generated WSDL.

spring-boot-samples/spring-boot-sample-ws/README.md

Lines changed: 0 additions & 14 deletions
This file was deleted.

spring-boot-samples/spring-boot-sample-ws/pom.xml

Lines changed: 17 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,44 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<project xmlns="http://maven.apache.org/POM/4.0.0"
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
3+
<modelVersion>4.0.0</modelVersion>
54
<parent>
5+
<!-- Your own application should inherit from spring-boot-starter-parent -->
66
<artifactId>spring-boot-samples</artifactId>
77
<groupId>org.springframework.boot</groupId>
88
<version>1.1.0.BUILD-SNAPSHOT</version>
99
</parent>
10-
<modelVersion>4.0.0</modelVersion>
11-
1210
<artifactId>spring-boot-sample-ws</artifactId>
13-
11+
<name>Spring Boot Web Services Sample</name>
12+
<description>Spring Boot Web Services Sample</description>
13+
<url>http://projects.spring.io/spring-boot/</url>
14+
<organization>
15+
<name>Pivotal Software, Inc.</name>
16+
<url>http://www.spring.io</url>
17+
</organization>
1418
<properties>
1519
<main.basedir>${basedir}/../..</main.basedir>
16-
<java.version>1.7</java.version>
1720
</properties>
1821
<dependencies>
1922
<dependency>
2023
<groupId>org.springframework.boot</groupId>
21-
<artifactId>spring-boot-starter-ws</artifactId>
24+
<artifactId>spring-boot-starter-test</artifactId>
25+
<scope>test</scope>
2226
</dependency>
2327
<dependency>
2428
<groupId>org.springframework.boot</groupId>
25-
<artifactId>spring-boot-starter-actuator</artifactId>
26-
</dependency>
27-
<dependency>
28-
<groupId>org.jdom</groupId>
29-
<artifactId>jdom</artifactId>
29+
<artifactId>spring-boot-starter-ws</artifactId>
3030
</dependency>
3131
<dependency>
3232
<groupId>jaxen</groupId>
3333
<artifactId>jaxen</artifactId>
3434
</dependency>
3535
<dependency>
36-
<groupId>wsdl4j</groupId>
37-
<artifactId>wsdl4j</artifactId>
36+
<groupId>org.jdom</groupId>
37+
<artifactId>jdom2</artifactId>
3838
</dependency>
3939
<dependency>
40-
<groupId>${project.groupId}</groupId>
41-
<artifactId>spring-boot-starter-test</artifactId>
42-
<scope>test</scope>
40+
<groupId>wsdl4j</groupId>
41+
<artifactId>wsdl4j</artifactId>
4342
</dependency>
4443
</dependencies>
4544
<build>

spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/SampleWsApplication.java

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
1+
/*
2+
* Copyright 2012-2014 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package sample.ws;
217

318
import org.springframework.boot.SpringApplication;
419
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
520
import org.springframework.context.annotation.ComponentScan;
621
import org.springframework.context.annotation.Configuration;
722

8-
/**
9-
* Created by in329dei on 28-2-14.
10-
*/
1123
@Configuration
1224
@EnableAutoConfiguration
1325
@ComponentScan

spring-boot-samples/spring-boot-sample-ws/src/main/java/sample/ws/WebServiceConfig.java

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
/*
2+
* Copyright 2012-2014 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package sample.ws;
217

318
import org.springframework.boot.context.embedded.ServletRegistrationBean;
@@ -12,19 +27,14 @@
1227
import org.springframework.xml.xsd.SimpleXsdSchema;
1328
import org.springframework.xml.xsd.XsdSchema;
1429

15-
/**
16-
* Configures Spring Web Service components
17-
*
18-
* @author Maciej Walkowiak
19-
*/
2030
@EnableWs
2131
@Configuration
2232
public class WebServiceConfig extends WsConfigurerAdapter {
33+
2334
@Bean
2435
public ServletRegistrationBean dispatcherServlet(ApplicationContext applicationContext) {
2536
MessageDispatcherServlet servlet = new MessageDispatcherServlet();
2637
servlet.setApplicationContext(applicationContext);
27-
2838
return new ServletRegistrationBean(servlet, "/services/*");
2939
}
3040

Lines changed: 40 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,26 @@
1+
/*
2+
* Copyright 2012-2014 the original author or authors.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
116
package sample.ws.endpoint;
217

18+
import java.text.SimpleDateFormat;
19+
import java.util.Date;
20+
21+
import javax.xml.xpath.XPathExpressionException;
22+
import javax.xml.xpath.XPathFactoryConfigurationException;
23+
324
import org.jdom2.Element;
425
import org.jdom2.JDOMException;
526
import org.jdom2.Namespace;
@@ -10,17 +31,9 @@
1031
import org.springframework.ws.server.endpoint.annotation.Endpoint;
1132
import org.springframework.ws.server.endpoint.annotation.PayloadRoot;
1233
import org.springframework.ws.server.endpoint.annotation.RequestPayload;
13-
import sample.ws.service.HumanResourceService;
1434

15-
import javax.xml.xpath.XPathExpressionException;
16-
import javax.xml.xpath.XPathFactoryConfigurationException;
17-
import java.text.SimpleDateFormat;
18-
import java.util.Date;
35+
import sample.ws.service.HumanResourceService;
1936

20-
/**
21-
* @author in329dei
22-
* @author Maciej Walkowiak
23-
*/
2437
@Endpoint
2538
public class HolidayEndpoint {
2639

@@ -33,25 +46,34 @@ public class HolidayEndpoint {
3346
private HumanResourceService humanResourceService;
3447

3548
@Autowired
36-
public HolidayEndpoint(HumanResourceService humanResourceService) throws JDOMException, XPathFactoryConfigurationException, XPathExpressionException {
49+
public HolidayEndpoint(HumanResourceService humanResourceService)
50+
throws JDOMException, XPathFactoryConfigurationException,
51+
XPathExpressionException {
3752
this.humanResourceService = humanResourceService;
3853

3954
Namespace namespace = Namespace.getNamespace("hr", NAMESPACE_URI);
4055

4156
XPathFactory xPathFactory = XPathFactory.instance();
4257

43-
startDateExpression = xPathFactory.compile("//hr:StartDate", Filters.element(), null, namespace);
44-
endDateExpression = xPathFactory.compile("//hr:EndDate", Filters.element(), null, namespace);
45-
nameExpression = xPathFactory.compile("concat(//hr:FirstName,' ',//hr:LastName)", Filters.fstring(), null, namespace);
58+
this.startDateExpression = xPathFactory.compile("//hr:StartDate",
59+
Filters.element(), null, namespace);
60+
this.endDateExpression = xPathFactory.compile("//hr:EndDate", Filters.element(),
61+
null, namespace);
62+
this.nameExpression = xPathFactory.compile(
63+
"concat(//hr:FirstName,' ',//hr:LastName)", Filters.fstring(), null,
64+
namespace);
4665
}
4766

4867
@PayloadRoot(namespace = NAMESPACE_URI, localPart = "HolidayRequest")
49-
public void handleHolidayRequest(@RequestPayload Element holidayRequest) throws Exception {
68+
public void handleHolidayRequest(@RequestPayload Element holidayRequest)
69+
throws Exception {
5070
SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
51-
Date startDate = dateFormat.parse(startDateExpression.evaluateFirst(holidayRequest).getText());
52-
Date endDate = dateFormat.parse(endDateExpression.evaluateFirst(holidayRequest).getText());
53-
String name = nameExpression.evaluateFirst(holidayRequest);
71+
Date startDate = dateFormat.parse(this.startDateExpression.evaluateFirst(
72+
holidayRequest).getText());
73+
Date endDate = dateFormat.parse(this.endDateExpression.evaluateFirst(
74+
holidayRequest).getText());
75+
String name = this.nameExpression.evaluateFirst(holidayRequest);
5476

55-
humanResourceService.bookHoliday(startDate, endDate, name);
77+
this.humanResourceService.bookHoliday(startDate, endDate, name);
5678
}
5779
}

0 commit comments

Comments
 (0)