<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=youngm" rel="nofollow">Mike Youngstrom</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-4372?redirect=false" rel="nofollow">SPR-4372</a></strong> and commented</p>
<p dir="auto">I would like to do some custom operations when scanning for components which has lead me to wish for some additional extension points the Spring Component Scanning.</p>
<ol dir="auto">
<li>
<p dir="auto">It would be nice if there were some sort of way to manipulate each BeanDefinitions found in ClassPathBeanDefinitionScanner.doScan prior to them being registered.  A simple protected callback method would be sufficient for my needs.</p>
</li>
<li>
<p dir="auto">Provide some way to specify a custom ClassPathBeanDefinitionScanner in ComponentScanBeanDefinitionParser so that in order to use my custom ClassPathBeanDefinitionScanner I won't have to completely re-implement ComponentScanBeanDefinitionParser.parse()</p>
</li>
</ol>
<p dir="auto">Thoughts?</p>
<p dir="auto">Mike</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 2.5.1</p>
<p dir="auto"><strong><a href="https://jira.spring.io/secure/ViewProfile.jspa?name=drubio" rel="nofollow">Daniel Rubio</a></strong> opened <strong><a href="https://jira.spring.io/browse/SPR-6082?redirect=false" rel="nofollow">SPR-6082</a></strong> and commented</p>
<p dir="auto">upgrading a functioning 2.5 app to the most recent 3.0 (M4) release.</p>
<p dir="auto">I have the following bean definition that fails in 3.0 M4:</p>
<p dir="auto">&lt;bean id="localeResolver"^M<br>
class="org.springframework.web.servlet.i18n.CookieLocaleResolver"&gt;^M<br>
&lt;property name="cookieName" value="language" /&gt;^M<br>
&lt;property name="cookieMaxAge" value="3600" /&gt;^M<br>
&lt;property name="defaultLocale" value="en" /&gt;^M<br>
&lt;/bean&gt;</p>
<p dir="auto">When I deploy this in Tomcat 6.20 I get the following error.</p>
<p dir="auto">SEVERE: Allocate exception for servlet court<br>
org.springframework.beans.NotWritablePropertyException: Invalid property 'cookieMaxAge' of bean class [org.springframework.web.servlet.i18n.CookieLocaleResolver]: Bean property 'cookieMaxAge' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?<br>
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:850)<br>
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:701)<br>
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78)<br>
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:60)<br>
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1330)<br>
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1060)<br>
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:510)<br>
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:449)<br>
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:289)<br>
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)<br>
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:286)<br>
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:188)<br>
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:528)<br>
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:716)<br>
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:383)<br>
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:447)<br>
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:342)<br>
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:308)<br>
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:127)<br>
at javax.servlet.GenericServlet.init(GenericServlet.java:212)<br>
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1173)<br>
at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:809)<br>
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:129)<br>
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)<br>
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)<br>
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)<br>
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)</p>
<p dir="auto">I reviewed the docs on M4</p>
<p dir="auto"><a href="http://static.springsource.org/spring/docs/3.0.0.M4/javadoc-api/org/springframework/web/servlet/i18n/CookieLocaleResolver.html" rel="nofollow">http://static.springsource.org/spring/docs/3.0.0.M4/javadoc-api/org/springframework/web/servlet/i18n/CookieLocaleResolver.html</a></p>
<p dir="auto">The method is inherited from org.springframework.web.util.CookieGenerator . I saw the source<br>
<a href="https://src.springframework.org/svn/spring-framework/tags/spring-framework-3.0.0.M4/org.springframework.web/src/main/java/org/springframework/web/util/CookieGenerator.java" rel="nofollow">https://src.springframework.org/svn/spring-framework/tags/spring-framework-3.0.0.M4/org.springframework.web/src/main/java/org/springframework/web/util/CookieGenerator.java</a><br>
And the set and getCookieMaxAge methods appears to be there.</p>
<p dir="auto">Not exactly sure what is the root of this error message/bug.</p>
<hr>
<p dir="auto"><strong>Affects:</strong> 3.0 M4</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="398097253" data-permission-text="Title is private" data-url="https://github.com/spring-projects/spring-framework/issues/10738" data-hovercard-type="issue" data-hovercard-url="/spring-projects/spring-framework/issues/10738/hovercard" href="https://github.com/spring-projects/spring-framework/issues/10738">#10738</a> Differing types for getter/setter of CookieGenerator.cookieMaxAge causes configuring to fail. (<em><strong>"duplicates"</strong></em>)</li>
</ul>