Pārlūkot izejas kodu

Upgrade to Spring Boot 2.0.1.RELEASE

This commit upgrades the Spring Boot version to the
2.0.1.RELEASE including all the updates with the
referenced libraries. Like Hibernate 5 and a newer
connection pool.

As Spring Boot 2 doesn't support log4j (the 1.x
version) anymore we replaced logging (where needed)
with the SLF4J API.
Marten Deinum 8 gadus atpakaļ
vecāks
revīzija
5007e64e79
Revīzijas autora e-pasts nav piesaistīts nevienam kontam

+ 14
- 9
pom.xml Parādīt failu

@@ -8,7 +8,7 @@
8 8
     <parent>
9 9
         <groupId>org.springframework.boot</groupId>
10 10
         <artifactId>spring-boot-starter-parent</artifactId>
11
-        <version>1.5.10.RELEASE</version>
11
+        <version>2.0.1.RELEASE</version>
12 12
     </parent>
13 13
     <description>This application shows a few key concepts of
14 14
         Domain Driven Design implemented in Enterprise Java.
@@ -71,8 +71,8 @@
71 71
     </scm>
72 72
     <properties>
73 73
         <java.version>1.8</java.version>
74
-        <assertj.version>3.8.0</assertj.version>
75
-        <hibernate.version>4.3.5.Final</hibernate.version>
74
+        <!--<assertj.version>3.8.0</assertj.version>-->
75
+        <!--<hibernate.version>4.3.5.Final</hibernate.version>-->
76 76
     </properties>
77 77
     <build>
78 78
         <plugins>
@@ -102,12 +102,13 @@
102 102
         <dependency>
103 103
             <groupId>org.apache.cxf</groupId>
104 104
             <artifactId>cxf-spring-boot-starter-jaxws</artifactId>
105
-            <version>3.1.12</version>
105
+            <version>3.2.4</version>
106 106
         </dependency>
107 107
         <dependency>
108 108
             <groupId>org.hibernate</groupId>
109 109
             <artifactId>hibernate-core</artifactId>
110 110
         </dependency>
111
+
111 112
         <dependency>
112 113
             <groupId>commons-collections</groupId>
113 114
             <artifactId>commons-collections</artifactId>
@@ -116,16 +117,16 @@
116 117
         <dependency>
117 118
             <groupId>commons-lang</groupId>
118 119
             <artifactId>commons-lang</artifactId>
119
-            <version>2.3</version>
120
+            <version>2.6</version>
120 121
         </dependency>
121 122
         <dependency>
122 123
             <groupId>commons-io</groupId>
123 124
             <artifactId>commons-io</artifactId>
124
-            <version>2.4</version>
125
+            <version>2.6</version>
125 126
         </dependency>
126 127
         <dependency>
127
-            <groupId>commons-dbcp</groupId>
128
-            <artifactId>commons-dbcp</artifactId>
128
+            <groupId>com.zaxxer</groupId>
129
+            <artifactId>HikariCP</artifactId>
129 130
         </dependency>
130 131
         <dependency>
131 132
             <groupId>org.hsqldb</groupId>
@@ -143,7 +144,7 @@
143 144
         <dependency>
144 145
             <groupId>org.apache.xbean</groupId>
145 146
             <artifactId>xbean-spring</artifactId>
146
-            <version>3.4.3</version>
147
+            <version>4.8</version>
147 148
         </dependency>
148 149
         <dependency>
149 150
             <groupId>org.springframework.boot</groupId>
@@ -160,6 +161,10 @@
160 161
             <artifactId>selenium-java</artifactId>
161 162
             <scope>test</scope>
162 163
         </dependency>
164
+        <dependency>
165
+            <groupId>org.seleniumhq.selenium</groupId>
166
+            <artifactId>htmlunit-driver</artifactId>
167
+        </dependency>
163 168
     </dependencies>
164 169
 
165 170
     <reporting>

+ 2
- 2
src/main/java/se/citerus/dddsample/interfaces/booking/facade/internal/BookingServiceFacadeImpl.java Parādīt failu

@@ -1,6 +1,5 @@
1 1
 package se.citerus.dddsample.interfaces.booking.facade.internal;
2 2
 
3
-import org.apache.log4j.Logger;
4 3
 import se.citerus.dddsample.application.BookingService;
5 4
 import se.citerus.dddsample.domain.model.cargo.Cargo;
6 5
 import se.citerus.dddsample.domain.model.cargo.CargoRepository;
@@ -23,6 +22,8 @@ import java.util.ArrayList;
23 22
 import java.util.Date;
24 23
 import java.util.List;
25 24
 
25
+import org.slf4j.Logger;
26
+import org.slf4j.LoggerFactory;
26 27
 
27 28
 /**
28 29
  * This implementation has additional support from the infrastructure, for exposing as an RMI
@@ -36,7 +37,6 @@ public class BookingServiceFacadeImpl implements BookingServiceFacade {
36 37
   private LocationRepository locationRepository;
37 38
   private CargoRepository cargoRepository;
38 39
   private VoyageRepository voyageRepository;
39
-  private final Logger logger = Logger.getLogger(BookingServiceFacadeImpl.class);
40 40
 
41 41
   @Override
42 42
   public List<LocationDTO> listShippingLocations() {

+ 2
- 3
src/main/resources/application.properties Parādīt failu

@@ -1,6 +1,5 @@
1
-server.contextPath=/dddsample
1
+server.servlet.context-path=/dddsample
2 2
 cxf.path=/ws
3 3
 
4
-logging.level.org.hibernate.SQL=debug
5
-logging.level.org.hibernate.hbm2ddl=debug
4
+logging.level.org.hibernate.SQL=info
6 5
 logging.level.net.sf.ehcache.config.ConfigurationFactory=error

+ 2
- 2
src/main/resources/context-infrastructure-messaging.xml Parādīt failu

@@ -5,8 +5,8 @@
5 5
        xmlns:amq="http://activemq.apache.org/schema/core"
6 6
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
7 7
        xsi:schemaLocation="
8
-        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
9
-        http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms-2.5.xsd
8
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
9
+        http://www.springframework.org/schema/jms http://www.springframework.org/schema/jms/spring-jms.xsd
10 10
         http://activemq.apache.org/schema/core http://activemq.apache.org/schema/core/activemq-core.xsd">
11 11
 
12 12
   <!-- JMS messaging -->

+ 11
- 12
src/main/resources/context-infrastructure-persistence.xml Parādīt failu

@@ -2,32 +2,31 @@
2 2
 
3 3
 <beans xmlns="http://www.springframework.org/schema/beans"
4 4
        xmlns:tx="http://www.springframework.org/schema/tx"
5
-       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
5
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:context="http://www.springframework.org/schema/context"
6 6
        xsi:schemaLocation="
7
-        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
8
-        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.5.xsd">
7
+        http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
8
+        http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
9
+        http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
9 10
 
10 11
   <!-- Persistence - database, Hibernate, transactions, repository implementations -->
11 12
 
12
-  <bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
13
-    <property name="location" value="classpath:/jdbc.properties"/>
14
-  </bean>
13
+  <context:property-placeholder location="classpath:/jdbc.properties" />
15 14
 
16
-  <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
17
-    <property name="url" value="${hibernate.connection.url}"/>
15
+  <bean id="dataSource" class="com.zaxxer.hikari.HikariDataSource">
16
+    <property name="jdbcUrl" value="${hibernate.connection.url}"/>
18 17
     <property name="driverClassName" value="${hibernate.connection.driver_class}"/>
19 18
     <property name="username" value="${hibernate.connection.username}"/>
20 19
     <property name="password" value="${hibernate.connection.password}"/>
21
-    <property name="initialSize" value="4"/>
22
-    <property name="defaultAutoCommit" value="false"/>
20
+    <property name="minimumIdle" value="4"/>
21
+    <property name="autoCommit" value="false"/>
23 22
   </bean>
24 23
 
25
-  <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
24
+  <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
26 25
     <property name="dataSource" ref="dataSource"/>
27 26
     <property name="configLocation" value="classpath:/hibernate.cfg.xml"/>
28 27
   </bean>
29 28
 
30
-  <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
29
+  <bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
31 30
     <property name="sessionFactory" ref="sessionFactory"/>
32 31
   </bean>
33 32
 

+ 2
- 5
src/main/resources/context-interfaces.xml Parādīt failu

@@ -8,12 +8,10 @@
8 8
        xsi:schemaLocation="http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd
9 9
                            http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
10 10
                            http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd
11
-                           http://www.springframework.org/schema/mvc
12
-                           http://www.springframework.org/schema/mvc/spring-mvc.xsd">
11
+                           http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd">
13 12
 
14 13
     <import resource="classpath:META-INF/cxf/cxf.xml"/>
15 14
 
16
-
17 15
     <!-- Handling report web service -->
18 16
 
19 17
     <jaxws:endpoint id="jax-ws.http" implementor="#handlingReportService" address="/RegisterEvent"/>
@@ -22,7 +20,6 @@
22 20
         <property name="applicationEvents" ref="applicationEvents"/>
23 21
     </bean>
24 22
 
25
-
26 23
     <!-- File upload directory scanner -->
27 24
 
28 25
     <task:scheduled-tasks scheduler="myScheduler">
@@ -70,7 +67,7 @@
70 67
     </bean>
71 68
 
72 69
     <mvc:interceptors>
73
-        <bean id="openSessionInViewInterceptor" class="org.springframework.orm.hibernate4.support.OpenSessionInViewInterceptor">
70
+        <bean id="openSessionInViewInterceptor" class="org.springframework.orm.hibernate5.support.OpenSessionInViewInterceptor">
74 71
             <property name="sessionFactory" ref="sessionFactory"/>
75 72
         </bean>
76 73
     </mvc:interceptors>

+ 0
- 2
src/main/resources/hibernate.cfg.xml Parādīt failu

@@ -8,8 +8,6 @@
8 8
 
9 9
   <session-factory>
10 10
     <!-- Properties defined here are shared between test and production -->
11
-    <property name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
12
-    
13 11
     <mapping resource="se/citerus/dddsample/infrastructure/persistence/hibernate/Cargo.hbm.xml" />
14 12
     <mapping resource="se/citerus/dddsample/infrastructure/persistence/hibernate/Voyage.hbm.xml" />
15 13
     <mapping resource="se/citerus/dddsample/infrastructure/persistence/hibernate/Leg.hbm.xml" />

+ 3
- 2
src/test/java/se/citerus/dddsample/application/BookingServiceTest.java Parādīt failu

@@ -1,8 +1,9 @@
1 1
 package se.citerus.dddsample.application;
2 2
 
3 3
 import static org.assertj.core.api.Assertions.assertThat;
4
-import static org.mockito.Matchers.any;
5
-import static org.mockito.Matchers.isA;
4
+
5
+import static org.mockito.ArgumentMatchers.any;
6
+import static org.mockito.ArgumentMatchers.isA;
6 7
 import static org.mockito.Mockito.mock;
7 8
 import static org.mockito.Mockito.times;
8 9
 import static org.mockito.Mockito.verify;

+ 1
- 1
src/test/java/se/citerus/dddsample/application/HandlingEventServiceTest.java Parādīt failu

@@ -1,6 +1,6 @@
1 1
 package se.citerus.dddsample.application;
2 2
 
3
-import static org.mockito.Matchers.isA;
3
+import static org.mockito.ArgumentMatchers.isA;
4 4
 import static org.mockito.Mockito.mock;
5 5
 import static org.mockito.Mockito.times;
6 6
 import static org.mockito.Mockito.verify;

+ 2
- 2
src/test/java/se/citerus/dddsample/infrastructure/persistence/hibernate/CargoRepositoryTest.java Parādīt failu

@@ -25,9 +25,9 @@ import org.junit.Test;
25 25
 import org.junit.runner.RunWith;
26 26
 import org.springframework.beans.factory.annotation.Autowired;
27 27
 import org.springframework.jdbc.core.JdbcTemplate;
28
-import org.springframework.orm.hibernate4.HibernateTransactionManager;
29 28
 import org.springframework.test.context.ContextConfiguration;
30 29
 import org.springframework.test.context.junit4.SpringRunner;
30
+import org.springframework.transaction.PlatformTransactionManager;
31 31
 import org.springframework.transaction.annotation.Transactional;
32 32
 import org.springframework.transaction.support.TransactionTemplate;
33 33
 
@@ -71,7 +71,7 @@ public class CargoRepositoryTest {
71 71
     private DataSource dataSource;
72 72
 
73 73
     @Autowired
74
-    private HibernateTransactionManager transactionManager;
74
+    private PlatformTransactionManager transactionManager;
75 75
 
76 76
     private JdbcTemplate jdbcTemplate;
77 77
 

+ 2
- 2
src/test/java/se/citerus/dddsample/infrastructure/persistence/hibernate/CarrierMovementRepositoryTest.java Parādīt failu

@@ -10,9 +10,9 @@ import org.junit.Test;
10 10
 import org.junit.runner.RunWith;
11 11
 import org.springframework.beans.factory.annotation.Autowired;
12 12
 import org.springframework.jdbc.core.JdbcTemplate;
13
-import org.springframework.orm.hibernate4.HibernateTransactionManager;
14 13
 import org.springframework.test.context.ContextConfiguration;
15 14
 import org.springframework.test.context.junit4.SpringRunner;
15
+import org.springframework.transaction.PlatformTransactionManager;
16 16
 import org.springframework.transaction.annotation.Transactional;
17 17
 import org.springframework.transaction.support.TransactionTemplate;
18 18
 
@@ -36,7 +36,7 @@ public class CarrierMovementRepositoryTest {
36 36
     private DataSource dataSource;
37 37
 
38 38
     @Autowired
39
-    private HibernateTransactionManager transactionManager;
39
+    private PlatformTransactionManager transactionManager;
40 40
 
41 41
     private JdbcTemplate jdbcTemplate;
42 42
 

+ 2
- 2
src/test/java/se/citerus/dddsample/infrastructure/persistence/hibernate/HandlingEventRepositoryTest.java Parādīt failu

@@ -17,9 +17,9 @@ import org.junit.Test;
17 17
 import org.junit.runner.RunWith;
18 18
 import org.springframework.beans.factory.annotation.Autowired;
19 19
 import org.springframework.jdbc.core.JdbcTemplate;
20
-import org.springframework.orm.hibernate4.HibernateTransactionManager;
21 20
 import org.springframework.test.context.ContextConfiguration;
22 21
 import org.springframework.test.context.junit4.SpringRunner;
22
+import org.springframework.transaction.PlatformTransactionManager;
23 23
 import org.springframework.transaction.annotation.Transactional;
24 24
 import org.springframework.transaction.support.TransactionTemplate;
25 25
 
@@ -54,7 +54,7 @@ public class HandlingEventRepositoryTest {
54 54
     private DataSource dataSource;
55 55
 
56 56
     @Autowired
57
-    private HibernateTransactionManager transactionManager;
57
+    private PlatformTransactionManager transactionManager;
58 58
 
59 59
     private JdbcTemplate jdbcTemplate;
60 60
 

+ 2
- 2
src/test/java/se/citerus/dddsample/infrastructure/persistence/hibernate/LocationRepositoryTest.java Parādīt failu

@@ -11,9 +11,9 @@ import org.junit.Test;
11 11
 import org.junit.runner.RunWith;
12 12
 import org.springframework.beans.factory.annotation.Autowired;
13 13
 import org.springframework.jdbc.core.JdbcTemplate;
14
-import org.springframework.orm.hibernate4.HibernateTransactionManager;
15 14
 import org.springframework.test.context.ContextConfiguration;
16 15
 import org.springframework.test.context.junit4.SpringRunner;
16
+import org.springframework.transaction.PlatformTransactionManager;
17 17
 import org.springframework.transaction.annotation.Transactional;
18 18
 import org.springframework.transaction.support.TransactionTemplate;
19 19
 
@@ -33,7 +33,7 @@ public class LocationRepositoryTest {
33 33
     private DataSource dataSource;
34 34
 
35 35
     @Autowired
36
-    private HibernateTransactionManager transactionManager;
36
+    private PlatformTransactionManager transactionManager;
37 37
 
38 38
     @Before
39 39
     public void setup() {

+ 1
- 1
src/test/java/se/citerus/dddsample/infrastructure/routing/ExternalRoutingServiceTest.java Parādīt failu

@@ -18,7 +18,7 @@ import java.util.Date;
18 18
 import java.util.List;
19 19
 
20 20
 import static org.assertj.core.api.Assertions.assertThat;
21
-import static org.mockito.Matchers.isA;
21
+import static org.mockito.ArgumentMatchers.isA;
22 22
 import static org.mockito.Mockito.mock;
23 23
 import static org.mockito.Mockito.when;
24 24
 import static se.citerus.dddsample.domain.model.location.SampleLocations.*;