Author: sergeyb
Date: Thu Aug 29 17:00:10 2013
New Revision: 1518708

URL: http://svn.apache.org/r1518708
Log:
[CXF-5245] Minor updates

Modified:
    
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/SpringResourceFactory.java

Modified: 
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/SpringResourceFactory.java
URL: 
http://svn.apache.org/viewvc/cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/SpringResourceFactory.java?rev=1518708&r1=1518707&r2=1518708&view=diff
==============================================================================
--- 
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/SpringResourceFactory.java
 (original)
+++ 
cxf/trunk/rt/frontend/jaxrs/src/main/java/org/apache/cxf/jaxrs/spring/SpringResourceFactory.java
 Thu Aug 29 17:00:10 2013
@@ -96,7 +96,7 @@ public class SpringResourceFactory imple
     }
 
     protected void initInstance(Message m, Object instance) {
-        if (callPostConstruct) {
+        if (isCallPostConstruct()) {
             
InjectionUtils.invokeLifeCycleMethod(ClassHelper.getRealObject(instance), 
postConstructMethod);
         }
     }
@@ -114,10 +114,14 @@ public class SpringResourceFactory imple
      * {@inheritDoc}
      */
     public void releaseInstance(Message m, Object o) {
-        if (callPreDestroy && isPrototype) {
+        if (doCallPreDestroy()) {
             InjectionUtils.invokeLifeCycleMethod(o, preDestroyMethod);
         }
     }
+    
+    protected boolean doCallPreDestroy() {
+        return isCallPreDestroy() && isPrototype;
+    }
 
     public void setApplicationContext(ApplicationContext applicationContext) 
throws BeansException {
         ac = applicationContext;
@@ -146,11 +150,19 @@ public class SpringResourceFactory imple
     public void setCallPostConstruct(boolean callPostConstruct) {
         this.callPostConstruct = callPostConstruct;
     }
+    
+    public boolean isCallPostConstruct() {
+        return this.callPostConstruct;
+    }
 
     public void setCallPreDestroy(boolean callPreDestroy) {
         this.callPreDestroy = callPreDestroy;
     }
 
+    public boolean isCallPreDestroy() {
+        return this.callPreDestroy;
+    }
+    
     public void setPreDestroyMethodName(String preDestroyMethodName) {
         this.preDestroyMethodName = preDestroyMethodName;
     }


Reply via email to