shiro-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fpa...@apache.org
Subject [shiro] branch master updated: SHIRO-704 - Update Spring, Spring Boot + Hibernate
Date Sat, 15 Jun 2019 18:07:28 GMT
This is an automated email from the ASF dual-hosted git repository.

fpapon pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shiro.git


The following commit(s) were added to refs/heads/master by this push:
     new 8767b7d  SHIRO-704 - Update Spring, Spring Boot + Hibernate
     new 2e0209b  Merge pull request #148 from coheigea/SHIRO-704
8767b7d is described below

commit 8767b7dcda191dfb9e3a3a016839ee2a960026fb
Author: Colm O hEigeartaigh <coheigea@apache.org>
AuthorDate: Fri Jun 14 11:43:28 2019 +0100

    SHIRO-704 - Update Spring, Spring Boot + Hibernate
---
 pom.xml                                                           | 6 +++---
 .../java/org/apache/shiro/samples/RestrictedErrorController.java  | 8 ++++----
 .../src/main/java/org/apache/shiro/samples/sprhib/model/User.java | 2 +-
 .../src/main/webapp/WEB-INF/applicationContext.xml                | 4 ++--
 .../spring-hibernate/src/main/webapp/WEB-INF/sprhib-servlet.xml   | 6 +++---
 samples/spring-hibernate/src/main/webapp/WEB-INF/web.xml          | 5 +----
 .../samples/spring/config/ServletApplicationInitializer.java      | 3 ---
 7 files changed, 14 insertions(+), 20 deletions(-)

diff --git a/pom.xml b/pom.xml
index b8274e7..c3c2771 100644
--- a/pom.xml
+++ b/pom.xml
@@ -101,8 +101,8 @@
         <slf4j.version>1.7.26</slf4j.version>
         <logback.version>1.2.3</logback.version>
         <log4j.version>1.2.17</log4j.version>
-        <spring.version>4.3.24.RELEASE</spring.version>
-        <spring-boot.version>1.5.21.RELEASE</spring-boot.version>
+        <spring.version>5.1.7.RELEASE</spring.version>
+        <spring-boot.version>2.1.5.RELEASE</spring-boot.version>
         <guice.version>3.0</guice.version>
         <jaxrs.api.version>2.0.1</jaxrs.api.version>
         <htmlunit.version>2.35.0</htmlunit.version>
@@ -113,7 +113,7 @@
         <groovy.version>2.4.7</groovy.version>
         <junit.version>4.12</junit.version>
         <junit.server.jetty.version>0.11.0</junit.server.jetty.version>
-        <hibernate.version>4.2.21.Final</hibernate.version>
+        <hibernate.version>5.4.3.Final</hibernate.version>
         <taglib.standard.version>1.1.2</taglib.standard.version>
         <!-- so we can mock static methods in 3rd party libraries that sometimes don't
use proper interfaces
              ahem, hazelcast, ahem... -->
diff --git a/samples/spring-boot-web/src/main/java/org/apache/shiro/samples/RestrictedErrorController.java
b/samples/spring-boot-web/src/main/java/org/apache/shiro/samples/RestrictedErrorController.java
index e283c1e..53603e0 100644
--- a/samples/spring-boot-web/src/main/java/org/apache/shiro/samples/RestrictedErrorController.java
+++ b/samples/spring-boot-web/src/main/java/org/apache/shiro/samples/RestrictedErrorController.java
@@ -19,12 +19,12 @@
 package org.apache.shiro.samples;
 
 import org.springframework.beans.factory.annotation.Autowired;
-import org.springframework.boot.autoconfigure.web.ErrorAttributes;
-import org.springframework.boot.autoconfigure.web.ErrorController;
+import org.springframework.boot.web.servlet.error.ErrorAttributes;
+import org.springframework.boot.web.servlet.error.ErrorController;
 import org.springframework.stereotype.Controller;
 import org.springframework.ui.Model;
 import org.springframework.web.bind.annotation.RequestMapping;
-import org.springframework.web.context.request.ServletRequestAttributes;
+import org.springframework.web.context.request.ServletWebRequest;
 
 import javax.servlet.http.HttpServletRequest;
 import java.util.Map;
@@ -45,7 +45,7 @@ public class RestrictedErrorController implements ErrorController {
 
     @RequestMapping(ERROR_PATH)
     String error(HttpServletRequest request, Model model) {
-        Map<String, Object> errorMap = errorAttributes.getErrorAttributes(new ServletRequestAttributes(request),
false);
+        Map<String, Object> errorMap = errorAttributes.getErrorAttributes(new ServletWebRequest(request),
false);
         model.addAttribute("errors", errorMap);
         return "error";
     }
diff --git a/samples/spring-hibernate/src/main/java/org/apache/shiro/samples/sprhib/model/User.java
b/samples/spring-hibernate/src/main/java/org/apache/shiro/samples/sprhib/model/User.java
index 6545a02..031c737 100644
--- a/samples/spring-hibernate/src/main/java/org/apache/shiro/samples/sprhib/model/User.java
+++ b/samples/spring-hibernate/src/main/java/org/apache/shiro/samples/sprhib/model/User.java
@@ -47,7 +47,7 @@ public class User  {
 
 
     @Id
-    @GeneratedValue
+    @GeneratedValue(strategy = GenerationType.IDENTITY)
     public Long getId() {
         return id;
     }
diff --git a/samples/spring-hibernate/src/main/webapp/WEB-INF/applicationContext.xml b/samples/spring-hibernate/src/main/webapp/WEB-INF/applicationContext.xml
index c8d1a81..7a4f2dd 100644
--- a/samples/spring-hibernate/src/main/webapp/WEB-INF/applicationContext.xml
+++ b/samples/spring-hibernate/src/main/webapp/WEB-INF/applicationContext.xml
@@ -51,7 +51,7 @@
     </bean>
 
     <!-- Hibernate SessionFactory -->
-    <bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
+    <bean id="sessionFactory" class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
         <property name="dataSource" ref="dataSource"/>
         <!-- Scan packages for JPA annotations -->
         <property name="packagesToScan" value="org.apache.shiro.samples.sprhib.model"/>
@@ -70,7 +70,7 @@
     </bean>
 
     <!-- Transaction support beans -->
-    <bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
+    <bean id="transactionManager" class="org.springframework.orm.hibernate5.HibernateTransactionManager">
         <property name="sessionFactory" ref="sessionFactory"/>
     </bean>
 
diff --git a/samples/spring-hibernate/src/main/webapp/WEB-INF/sprhib-servlet.xml b/samples/spring-hibernate/src/main/webapp/WEB-INF/sprhib-servlet.xml
index 6d9d353..701541b 100644
--- a/samples/spring-hibernate/src/main/webapp/WEB-INF/sprhib-servlet.xml
+++ b/samples/spring-hibernate/src/main/webapp/WEB-INF/sprhib-servlet.xml
@@ -38,12 +38,12 @@
 
     <!-- Enable annotation-based controllers using @Controller annotations -->
     <bean id="annotationUrlMapping"
-          class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping">
+          class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping">
         <property name="interceptors" ref="currentUserInterceptor"/>
     </bean>
 
     <bean id="annotationMethodHandlerAdapter"
-          class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter"/>
+          class="org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter"/>
 
     <!-- All views are JSPs loaded from /WEB-INF/jsp -->
     <bean id="viewResolver" class="org.springframework.web.servlet.view.UrlBasedViewResolver">
@@ -52,4 +52,4 @@
         <property name="suffix" value=".jsp"/>
     </bean>
 
-</beans>
\ No newline at end of file
+</beans>
diff --git a/samples/spring-hibernate/src/main/webapp/WEB-INF/web.xml b/samples/spring-hibernate/src/main/webapp/WEB-INF/web.xml
index db1303f..d874db2 100644
--- a/samples/spring-hibernate/src/main/webapp/WEB-INF/web.xml
+++ b/samples/spring-hibernate/src/main/webapp/WEB-INF/web.xml
@@ -45,9 +45,6 @@
  -  Servlet listeners
  -  =================================================================== -->
     <listener>
-        <listener-class>org.springframework.web.util.Log4jConfigListener</listener-class>
-    </listener>
-    <listener>
         <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
     </listener>
 
@@ -56,7 +53,7 @@
  -  =================================================================== -->
     <filter>
         <filter-name>openSessionInViewFilter</filter-name>
-        <filter-class>org.springframework.orm.hibernate4.support.OpenSessionInViewFilter</filter-class>
+        <filter-class>org.springframework.orm.hibernate5.support.OpenSessionInViewFilter</filter-class>
     </filter>
 
     <!-- Shiro Filter is defined in the spring application context: -->
diff --git a/samples/spring-mvc/src/main/java/org/apache/shiro/samples/spring/config/ServletApplicationInitializer.java
b/samples/spring-mvc/src/main/java/org/apache/shiro/samples/spring/config/ServletApplicationInitializer.java
index 66e503a..ad3e77a 100644
--- a/samples/spring-mvc/src/main/java/org/apache/shiro/samples/spring/config/ServletApplicationInitializer.java
+++ b/samples/spring-mvc/src/main/java/org/apache/shiro/samples/spring/config/ServletApplicationInitializer.java
@@ -23,7 +23,6 @@ import org.springframework.web.context.ContextLoaderListener;
 import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
 import org.springframework.web.filter.DelegatingFilterProxy;
 import org.springframework.web.servlet.DispatcherServlet;
-import org.springframework.web.util.Log4jConfigListener;
 
 import javax.servlet.DispatcherType;
 import javax.servlet.FilterRegistration;
@@ -45,8 +44,6 @@ public class ServletApplicationInitializer implements WebApplicationInitializer
         // Manage the lifecycle of the root application context
         container.addListener(new ContextLoaderListener(appContext));
 
-        container.addListener(new Log4jConfigListener());
-
         FilterRegistration.Dynamic shiroFilter = container.addFilter("shiroFilterFactoryBean",
DelegatingFilterProxy.class);
         shiroFilter.setInitParameter("targetFilterLifecycle", "true");
         shiroFilter.addMappingForUrlPatterns(EnumSet.allOf(DispatcherType.class), false,
"/*");


Mime
View raw message