<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=darren.davison" rel="nofollow">Darren Davison</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-4930?redirect=false" rel="nofollow">SPR-4930</a></strong> and commented</p>
<p dir="auto">We have a controller that uses <code class="notranslate">@SessionAttributes</code>, and as such Spring always adds HTTP headers to prevent caching (see AnnotationMethodHandlerAdapter.handle() )</p>
<p dir="auto">This is causing us a problem in that MSIE users invoke the controller, click links on the page generated by it, and then get the "This page has expired" warning from IE if they hit their back button.  Interestingly, if the HTTP headers are set to expire after 1 second, MSIE happily shows the user the page from cache, even though it really HAS expired according to the protocol, so there's definitely (yet another) IE fault at play here too.  Firefox and Safari don't exhibit this issue at all.</p>
<p dir="auto">There is no way to override this behaviour in the AnnotationMethodHandlerAdapter class at present, so I'm wondering if the default behaviour can be made more flexible?  Ideally this would be by way of an attribute on the <code class="notranslate">@RequestMapping</code> (or maybe a new annotation) which could be read by the handler adapter.  If no value is supplied, it defaults to 0, thus preserving current system behaviour and backwards compatibility, otherwise it specifies the cache seconds to use.</p>
<p dir="auto">Perhaps adding such an attribute to the RequestMapping/new annotation would provide more benefit in finer grained cache control for annotated controllers, falling back to that set on the handler adapter.</p>
<p dir="auto">I'll write and test the patch if any of that sounds like it might be acceptable.</p>
<p dir="auto">Or perhaps there's already some way to handle this that I missed..?</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.5.4</p>
<p dir="auto"><strong>Attachments:</strong></p>
<ul dir="auto">
<li><a href="https://jira.spring.io/secure/attachment/14195/SPR-4930.patch" rel="nofollow">SPR-4930.patch</a> (<em>5.14 kB</em>)</li>
</ul>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=abyrne" rel="nofollow">Ailish Byrne</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-2972?redirect=false" rel="nofollow">SPR-2972</a></strong> and commented</p>
<p dir="auto">i'm sure i'm just missing something, but i've looked and looked and can't figure out what it is. we are using mutiple BeanNameAutoProxyCreators - for transaction management, caching, and method logging. i upgraded to 2.0.1 then noticed that when a given bean was listed for more that one of the auto proxy creators, only one picked it up. i tried each auto proxy creator in turn and verified that it was working, confirming that the problem was just when more than one was in effect (i think). here is the related configuration from our SpringBeans.xml (slightly simplified to list only one bean for each auto proxy creator):</p>
<p dir="auto">&lt;bean id="transactionInterceptor" class="org.springframework.transaction.interceptor.TransactionInterceptor"&gt;<br>
&lt;property name="transactionManager"&gt;<br>
&lt;ref bean="transactionManager" /&gt;<br>
&lt;/property&gt;<br>
&lt;property name="transactionAttributeSource"&gt;<br>
&lt;bean id="transactionAttributeSource" class="org.kuali.core.util.spring.DefaultingNameMatchTransactionAttributeSource"&gt;<br>
&lt;property name="properties"&gt;<br>
&lt;props&gt;<br>
&lt;prop key="get*"&gt;PROPAGATION_SUPPORTS&lt;/prop&gt;<br>
&lt;prop key="is*"&gt;PROPAGATION_SUPPORTS&lt;/prop&gt;<br>
&lt;prop key="forceLookup*"&gt;PROPAGATION_SUPPORTS&lt;/prop&gt;<br>
&lt;prop key="noLookup*"&gt;PROPAGATION_SUPPORTS&lt;/prop&gt;<br>
&lt;prop key="performLookup*"&gt;PROPAGATION_SUPPORTS&lt;/prop&gt;<br>
&lt;prop key="find*"&gt;PROPAGATION_SUPPORTS&lt;/prop&gt;<br>
&lt;prop key="search*"&gt;PROPAGATION_SUPPORTS&lt;/prop&gt;<br>
&lt;prop key="retrieve*"&gt;PROPAGATION_SUPPORTS&lt;/prop&gt;<br>
&lt;prop key="count*"&gt;PROPAGATION_SUPPORTS&lt;/prop&gt;<br>
&lt;/props&gt;<br>
&lt;/property&gt;<br>
&lt;property name="nontransactionalMethods"&gt;<br>
&lt;list&gt;<br>
&lt;value&gt;getAllProperties&lt;/value&gt;<br>
&lt;value&gt;getPropertyString&lt;/value&gt;<br>
&lt;/list&gt;<br>
&lt;/property&gt;<br>
&lt;property name="defaultTransactionAttribute"&gt;<br>
&lt;value&gt;PROPAGATION_REQUIRED&lt;/value&gt;<br>
&lt;/property&gt;<br>
&lt;/bean&gt;<br>
&lt;/property&gt;<br>
&lt;/bean&gt;<br>
&lt;bean id="transactionAutoProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"&gt;<br>
&lt;property name="interceptorNames"&gt;<br>
&lt;list&gt;<br>
&lt;idref local="transactionInterceptor" /&gt;<br>
&lt;/list&gt;<br>
&lt;/property&gt;<br>
&lt;property name="beanNames"&gt;<br>
&lt;list&gt;<br>
&lt;idref bean="persistenceStructureService" /&gt;<br>
&lt;/list&gt;<br>
&lt;/property&gt;<br>
&lt;/bean&gt;<br>
&lt;bean id="methodResultsCacheAdministrator" class="com.opensymphony.oscache.general.GeneralCacheAdministrator" destroy-method="destroy"&gt;<br>
&lt;constructor-arg index="0"&gt;<br>
&lt;props&gt;<br>
&lt;prop key="cache.memory"&gt;true&lt;/prop&gt;<br>
&lt;prop key="cache.key"&gt;__oscache_mrcache&lt;/prop&gt;<br>
&lt;prop key="cache.persistence.overflow.only"&gt;false&lt;/prop&gt;<br>
&lt;prop key="cache.capacity"&gt;1000&lt;/prop&gt;<br>
&lt;prop key="cache.event.listeners"&gt;org.kuali.core.util.cache.MethodResultsCacheMonitor&lt;/prop&gt;<br>
&lt;/props&gt;<br>
&lt;/constructor-arg&gt;<br>
&lt;/bean&gt;<br>
&lt;bean id="methodCache" factory-bean="methodResultsCacheAdministrator" factory-method="getCache" /&gt;<br>
&lt;bean id="methodCacheInterceptor" class="org.kuali.core.util.cache.MethodCacheInterceptor"&gt;<br>
&lt;property name="cache"&gt;<br>
&lt;ref local="methodCache" /&gt;<br>
&lt;/property&gt;<br>
&lt;property name="expirationTimeInSeconds"&gt;<br>
&lt;value&gt;10&lt;/value&gt;<br>
&lt;/property&gt;<br>
&lt;/bean&gt;<br>
&lt;bean id="methodCachePointCut" class="org.springframework.aop.support.RegexpMethodPointcutAdvisor"&gt;<br>
&lt;property name="advice"&gt;<br>
&lt;ref local="methodCacheInterceptor" /&gt;<br>
&lt;/property&gt;<br>
&lt;property name="patterns"&gt;<br>
&lt;list&gt;<br>
&lt;value&gt;org.kuali.<em>.PersistenceStructureService.</em>..*&lt;/value&gt;<br>
&lt;/list&gt;<br>
&lt;/property&gt;<br>
&lt;/bean&gt;<br>
&lt;bean id="resultsCachingProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"&gt;<br>
&lt;property name="interceptorNames"&gt;<br>
&lt;list&gt;<br>
&lt;idref local="methodCachePointCut" /&gt;<br>
&lt;/list&gt;<br>
&lt;/property&gt;<br>
&lt;property name="beanNames"&gt;<br>
&lt;list&gt;<br>
&lt;idref bean="persistenceStructureService" /&gt;<br>
&lt;/list&gt;<br>
&lt;/property&gt;<br>
&lt;/bean&gt;<br>
&lt;bean id="methodLoggingPointCut" class="org.springframework.aop.support.DefaultPointcutAdvisor"&gt;<br>
&lt;property name="advice"&gt;<br>
&lt;bean id="methodLoggingInterceptor" class="org.kuali.core.util.spring.MethodLoggingInterceptor" /&gt;<br>
&lt;/property&gt;<br>
&lt;/bean&gt;<br>
&lt;bean id="methodLoggingProxyCreator" class="org.springframework.aop.framework.autoproxy.BeanNameAutoProxyCreator"&gt;<br>
&lt;property name="interceptorNames"&gt;<br>
&lt;list&gt;<br>
&lt;idref local="methodLoggingPointCut" /&gt;<br>
&lt;/list&gt;<br>
&lt;/property&gt;<br>
&lt;property name="beanNames"&gt;<br>
&lt;list&gt;<br>
&lt;idref bean="persistenceStructureService" /&gt;<br>
&lt;/list&gt;<br>
&lt;/property&gt;<br>
&lt;/bean&gt;</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.0.1</p>
<p dir="auto"><strong>Issue Links:</strong></p>
<ul dir="auto">
<li><a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="398074283" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/7695" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/7695/hovercard" href="https://github.com/spring-projects/spring-framework/issues/7695">#7695</a> fix of SPR-2721 broke nested proxies (<em><strong>"is duplicated by"</strong></em>)</li>
</ul>