diff --git a/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/jpa/DatabaseInitializer.java b/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/jpa/DatabaseInitializer.java
index 54d24aeb..a4a506a7 100644
--- a/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/jpa/DatabaseInitializer.java
+++ b/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/dao/jpa/DatabaseInitializer.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2007 the original author or authors.
+ * Copyright 2005-2011 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,13 +16,12 @@
package org.springframework.ws.samples.airline.dao.jpa;
+import javax.annotation.PostConstruct;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.joda.time.DateTime;
-import org.springframework.beans.factory.InitializingBean;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Component;
import org.springframework.transaction.PlatformTransactionManager;
import org.springframework.transaction.TransactionStatus;
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
@@ -32,16 +31,23 @@ import org.springframework.ws.samples.airline.domain.Flight;
import org.springframework.ws.samples.airline.domain.FrequentFlyer;
import org.springframework.ws.samples.airline.domain.ServiceClass;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.joda.time.DateTime;
+
/**
* A simple class that uses JPA to initialize the database.
*
* @author Arjen Poutsma
* @since 1.5.0
*/
-public class DatabaseInitializer implements InitializingBean {
+@Component
+public class DatabaseInitializer {
private static final Log logger = LogFactory.getLog(DatabaseInitializer.class);
+ private final TransactionTemplate transactionTemplate;
+
@PersistenceContext
private EntityManager entityManager;
@@ -49,13 +55,13 @@ public class DatabaseInitializer implements InitializingBean {
private Airport venice;
- private TransactionTemplate transactionTemplate;
-
- public void setTransactionManager(PlatformTransactionManager transactionManager) {
+ @Autowired
+ public DatabaseInitializer(PlatformTransactionManager transactionManager) {
this.transactionTemplate = new TransactionTemplate(transactionManager);
}
- public void afterPropertiesSet() throws Exception {
+ @PostConstruct
+ public void initDatabase() {
transactionTemplate.execute(new TransactionCallbackWithoutResult() {
protected void doInTransactionWithoutResult(TransactionStatus transactionStatus) {
logger.info("Initializing Database");
diff --git a/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/security/SpringFrequentFlyerSecurityService.java b/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/security/SpringFrequentFlyerSecurityService.java
index 88d4419e..355d2a7f 100644
--- a/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/security/SpringFrequentFlyerSecurityService.java
+++ b/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/security/SpringFrequentFlyerSecurityService.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2006 the original author or authors.
+ * Copyright 2005-2011 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,6 +16,7 @@
package org.springframework.ws.samples.airline.security;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.dao.DataAccessException;
import org.springframework.security.core.Authentication;
import org.springframework.security.core.context.SecurityContext;
@@ -37,6 +38,7 @@ public class SpringFrequentFlyerSecurityService implements FrequentFlyerSecurity
private FrequentFlyerDao frequentFlyerDao;
+ @Autowired
public SpringFrequentFlyerSecurityService(FrequentFlyerDao frequentFlyerDao) {
this.frequentFlyerDao = frequentFlyerDao;
}
diff --git a/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/service/impl/AirlineServiceImpl.java b/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/service/impl/AirlineServiceImpl.java
index 178cca2c..c9cfec12 100644
--- a/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/service/impl/AirlineServiceImpl.java
+++ b/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/service/impl/AirlineServiceImpl.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2006 the original author or authors.
+ * Copyright 2005-2011 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -17,11 +17,6 @@ package org.springframework.ws.samples.airline.service.impl;
import java.util.List;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.joda.time.DateTime;
-import org.joda.time.LocalDate;
-
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.annotation.Secured;
import org.springframework.stereotype.Service;
@@ -41,6 +36,11 @@ import org.springframework.ws.samples.airline.service.NoSeatAvailableException;
import org.springframework.ws.samples.airline.service.NoSuchFlightException;
import org.springframework.ws.samples.airline.service.NoSuchFrequentFlyerException;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.joda.time.DateTime;
+import org.joda.time.LocalDate;
+
/**
* Default implementation of the AirlineService interface.
*
@@ -64,7 +64,7 @@ public class AirlineServiceImpl implements AirlineService {
this.ticketDao = ticketDao;
}
- @Autowired
+ @Autowired(required = false)
public void setFrequentFlyerSecurityService(FrequentFlyerSecurityService frequentFlyerSecurityService) {
this.frequentFlyerSecurityService = frequentFlyerSecurityService;
}
diff --git a/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/web/FlightsController.java b/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/web/FlightsController.java
index 18631b2a..19e8525c 100644
--- a/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/web/FlightsController.java
+++ b/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/web/FlightsController.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2007 the original author or authors.
+ * Copyright 2005-2011 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,21 +16,24 @@
package org.springframework.ws.samples.airline.web;
-import org.joda.time.LocalDate;
-
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.util.Assert;
import org.springframework.util.StringUtils;
+import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.ws.samples.airline.domain.Flight;
import org.springframework.ws.samples.airline.domain.ServiceClass;
import org.springframework.ws.samples.airline.service.AirlineService;
+import org.springframework.ws.samples.airline.service.NoSuchFlightException;
+
+import org.joda.time.LocalDate;
/** @author Arjen Poutsma */
@Controller
+@RequestMapping("/flights")
public class FlightsController {
private AirlineService airlineService;
@@ -41,7 +44,7 @@ public class FlightsController {
this.airlineService = airlineService;
}
- @RequestMapping("/flights")
+ @RequestMapping
public String flightList(@RequestParam(value = "from", required = false)String fromAirportCode,
@RequestParam(value = "to", required = false)String toAirportCode,
@RequestParam(value = "departureDate", required = false)String departureDateString,
@@ -67,8 +70,8 @@ public class FlightsController {
return "flights";
}
- @RequestMapping(value = "/flight")
- public String singleFlight(@RequestParam("id")long id, ModelMap model) throws Exception {
+ @RequestMapping(value = "{id}")
+ public String singleFlight(@PathVariable("id") long id, ModelMap model) throws NoSuchFlightException {
Flight flight = airlineService.getFlight(id);
model.addAttribute(flight);
return "flight";
diff --git a/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/GetFrequentFlyerMileageEndpoint.java b/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/GetFrequentFlyerMileageEndpoint.java
index cc04b55a..c8c96abc 100644
--- a/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/GetFrequentFlyerMileageEndpoint.java
+++ b/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/GetFrequentFlyerMileageEndpoint.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2006 the original author or authors.
+ * Copyright 2005-2011 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -16,6 +16,7 @@
package org.springframework.ws.samples.airline.ws;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ws.samples.airline.service.AirlineService;
import org.springframework.ws.server.endpoint.AbstractDomPayloadEndpoint;
@@ -32,6 +33,7 @@ public class GetFrequentFlyerMileageEndpoint extends AbstractDomPayloadEndpoint
private final AirlineService airlineService;
+ @Autowired
public GetFrequentFlyerMileageEndpoint(AirlineService airlineService) {
this.airlineService = airlineService;
}
diff --git a/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/MarshallingAirlineEndpoint.java b/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/MarshallingAirlineEndpoint.java
index 36887c41..74aa95df 100644
--- a/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/MarshallingAirlineEndpoint.java
+++ b/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/MarshallingAirlineEndpoint.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2007 the original author or authors.
+ * Copyright 2005-2011 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -23,6 +23,7 @@ import javax.xml.bind.JAXBElement;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.datatype.XMLGregorianCalendar;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.Assert;
import org.springframework.ws.samples.airline.domain.FrequentFlyer;
import org.springframework.ws.samples.airline.domain.Passenger;
@@ -64,6 +65,7 @@ public class MarshallingAirlineEndpoint implements AirlineWebServiceConstants {
private ObjectFactory objectFactory = new ObjectFactory();
+ @Autowired
public MarshallingAirlineEndpoint(AirlineService airlineService) {
Assert.notNull(airlineService, "airlineService must not be null");
this.airlineService = airlineService;
diff --git a/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/XPathAirlineEndpoint.java b/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/XPathAirlineEndpoint.java
index ea525303..b8ff76ab 100644
--- a/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/XPathAirlineEndpoint.java
+++ b/samples/airline/server/src/main/java/org/springframework/ws/samples/airline/ws/XPathAirlineEndpoint.java
@@ -1,11 +1,11 @@
/*
- * Copyright 2007 the original author or authors.
+ * Copyright 2005-2011 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.
* You may obtain a copy of the License at
*
- * http://www.apache.org/licenses/LICENSE-2.0
+ * http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
@@ -23,6 +23,7 @@ import javax.xml.bind.JAXBException;
import javax.xml.datatype.DatatypeConfigurationException;
import javax.xml.transform.Source;
+import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.oxm.Marshaller;
import org.springframework.oxm.support.MarshallingSource;
import org.springframework.util.Assert;
@@ -71,6 +72,7 @@ public class XPathAirlineEndpoint implements AirlineWebServiceConstants {
private final Marshaller marshaller;
+ @Autowired
public XPathAirlineEndpoint(AirlineService airlineService, Marshaller marshaller) {
Assert.notNull(airlineService, "airlineService must not be null");
Assert.notNull(marshaller, "'marshaller' must not be null");
diff --git a/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/dao/jpa/applicationContext-jpa.xml b/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/dao/jpa/applicationContext-jpa.xml
index c932958c..850da863 100644
--- a/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/dao/jpa/applicationContext-jpa.xml
+++ b/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/dao/jpa/applicationContext-jpa.xml
@@ -1,30 +1,13 @@
-
+
+
-
-
- A DAO for Flights.
-
-
-
-
-
- A DAO for Tickets.
-
-
-
-
-
-
- A DAO for FrequentFlyers.
-
-
-
-
-
-
+
@@ -56,18 +39,4 @@
-
-
- Handles the @Repository annotation used on the JPA Dao's, and translates from the JPA
- exceptions to Spring's richer DataAccessException hierarchy.
-
-
-
-
-
- Injects the JPA PersistenceContext into the JPA Dao's.
-
-
-
-
diff --git a/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/jms/applicationContext-jms.xml b/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/jms/applicationContext-jms.xml
index b94a5a24..9ca02275 100644
--- a/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/jms/applicationContext-jms.xml
+++ b/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/jms/applicationContext-jms.xml
@@ -2,8 +2,8 @@
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-3.0.xsd">
diff --git a/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/security/applicationContext-security.xml b/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/security/applicationContext-security.xml
index 8a764974..3b5d299c 100644
--- a/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/security/applicationContext-security.xml
+++ b/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/security/applicationContext-security.xml
@@ -20,7 +20,6 @@
A security service used to obtain Frequent Flyer information.
-
diff --git a/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/service/applicationContext.xml b/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/service/applicationContext.xml
index 73f507ea..3c30f10a 100644
--- a/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/service/applicationContext.xml
+++ b/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/service/applicationContext.xml
@@ -3,20 +3,14 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:context="http://www.springframework.org/schema/context"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd
- http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.5.xsd
- http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-2.5.xsd">
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
+ http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
-
-
- The Airline business service. It requires a flight DAO and ticket DAO to work. The
- frequentFlyerSecurityService property is not required, so we use a property to configure it.
-
-
+
\ No newline at end of file
diff --git a/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/ws/applicationContext-ws.xml b/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/ws/applicationContext-ws.xml
index 45cc547e..c1302ad9 100644
--- a/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/ws/applicationContext-ws.xml
+++ b/samples/airline/server/src/main/resources/org/springframework/ws/samples/airline/ws/applicationContext-ws.xml
@@ -3,8 +3,8 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:oxm="http://www.springframework.org/schema/oxm"
xmlns:sws="http://www.springframework.org/schema/web-services"
- xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
- http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-1.5.xsd
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+ http://www.springframework.org/schema/oxm http://www.springframework.org/schema/oxm/spring-oxm-3.0.xsd
http://www.springframework.org/schema/web-services http://www.springframework.org/schema/web-services/web-services-1.5.xsd">
@@ -31,7 +31,6 @@
This endpoint handles the Airline Web Service messages using JAXB2 marshalling.
-
@@ -49,7 +46,6 @@
This endpoint handles get frequent flyer mileage requests.
-
diff --git a/samples/airline/server/src/main/webapp/WEB-INF/jsp/flight.jsp b/samples/airline/server/src/main/webapp/WEB-INF/jsp/flight.jsp
index a0244a0e..7c76fc04 100644
--- a/samples/airline/server/src/main/webapp/WEB-INF/jsp/flight.jsp
+++ b/samples/airline/server/src/main/webapp/WEB-INF/jsp/flight.jsp
@@ -42,6 +42,6 @@
-Flights
+Flights