You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@click.apache.org by "Andrea Cozzolino (Created) (JIRA)" <ji...@apache.org> on 2012/04/18 15:29:48 UTC
[jira] [Created] (CLK-789) SpringClickServlet injection fails if
"Page" class name starts with two or more upper case letters
SpringClickServlet injection fails if "Page" class name starts with two or more upper case letters
--------------------------------------------------------------------------------------------------
Key: CLK-789
URL: https://issues.apache.org/jira/browse/CLK-789
Project: Click
Issue Type: Bug
Components: core
Affects Versions: 2.3.0
Environment: Apache Tomcat 6.0.32 or 7.0.16. JRE 1.6.0_29 on Linux.
Spring Framework 3.0.5.
Reporter: Andrea Cozzolino
Priority: Minor
I am using SpringClickServlet to integrate Click with Spring.
Spring injection in "Page" classes works only if the class name starts with exactly one upper case letter.
If I have a class "ABTestPage" (that extends org.apache.click.Page and that is a @Component) when I try to use it, any @Resource is "null". If I rename the class to "AbTestPage", any @Resource is correctly injected.
The following simple project demonstrates the problem: https://bitbucket.org/andcoz/clickspringuppercasebug/
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Updated] (CLK-789) SpringClickServlet injection fails if
"Page" class name starts with two or more upper case letters
Posted by "Naoki Takezoe (Updated) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CLK-789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Naoki Takezoe updated CLK-789:
------------------------------
Fix Version/s: 2.3.1
> SpringClickServlet injection fails if "Page" class name starts with two or more upper case letters
> --------------------------------------------------------------------------------------------------
>
> Key: CLK-789
> URL: https://issues.apache.org/jira/browse/CLK-789
> Project: Click
> Issue Type: Bug
> Components: core
> Affects Versions: 2.3.0
> Environment: Apache Tomcat 6.0.32 or 7.0.16. JRE 1.6.0_29 on Linux.
> Spring Framework 3.0.5.
> Reporter: Andrea Cozzolino
> Assignee: Naoki Takezoe
> Priority: Minor
> Labels: spring
> Fix For: 2.3.1
>
>
> I am using SpringClickServlet to integrate Click with Spring.
> Spring injection in "Page" classes works only if the class name starts with exactly one upper case letter.
> If I have a class "ABTestPage" (that extends org.apache.click.Page and that is a @Component) when I try to use it, any @Resource is "null". If I rename the class to "AbTestPage", any @Resource is correctly injected.
> The following simple project demonstrates the problem: https://bitbucket.org/andcoz/clickspringuppercasebug/
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Assigned] (CLK-789) SpringClickServlet injection fails if
"Page" class name starts with two or more upper case letters
Posted by "Naoki Takezoe (Assigned) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CLK-789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Naoki Takezoe reassigned CLK-789:
---------------------------------
Assignee: Naoki Takezoe
> SpringClickServlet injection fails if "Page" class name starts with two or more upper case letters
> --------------------------------------------------------------------------------------------------
>
> Key: CLK-789
> URL: https://issues.apache.org/jira/browse/CLK-789
> Project: Click
> Issue Type: Bug
> Components: core
> Affects Versions: 2.3.0
> Environment: Apache Tomcat 6.0.32 or 7.0.16. JRE 1.6.0_29 on Linux.
> Spring Framework 3.0.5.
> Reporter: Andrea Cozzolino
> Assignee: Naoki Takezoe
> Priority: Minor
> Labels: spring
>
> I am using SpringClickServlet to integrate Click with Spring.
> Spring injection in "Page" classes works only if the class name starts with exactly one upper case letter.
> If I have a class "ABTestPage" (that extends org.apache.click.Page and that is a @Component) when I try to use it, any @Resource is "null". If I rename the class to "AbTestPage", any @Resource is correctly injected.
> The following simple project demonstrates the problem: https://bitbucket.org/andcoz/clickspringuppercasebug/
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Resolved] (CLK-789) SpringClickServlet injection fails if
"Page" class name starts with two or more upper case letters
Posted by "Naoki Takezoe (Resolved) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CLK-789?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Naoki Takezoe resolved CLK-789.
-------------------------------
Resolution: Fixed
Fixed in the trunk.
> SpringClickServlet injection fails if "Page" class name starts with two or more upper case letters
> --------------------------------------------------------------------------------------------------
>
> Key: CLK-789
> URL: https://issues.apache.org/jira/browse/CLK-789
> Project: Click
> Issue Type: Bug
> Components: core
> Affects Versions: 2.3.0
> Environment: Apache Tomcat 6.0.32 or 7.0.16. JRE 1.6.0_29 on Linux.
> Spring Framework 3.0.5.
> Reporter: Andrea Cozzolino
> Assignee: Naoki Takezoe
> Priority: Minor
> Labels: spring
> Fix For: 2.3.1
>
>
> I am using SpringClickServlet to integrate Click with Spring.
> Spring injection in "Page" classes works only if the class name starts with exactly one upper case letter.
> If I have a class "ABTestPage" (that extends org.apache.click.Page and that is a @Component) when I try to use it, any @Resource is "null". If I rename the class to "AbTestPage", any @Resource is correctly injected.
> The following simple project demonstrates the problem: https://bitbucket.org/andcoz/clickspringuppercasebug/
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira
[jira] [Commented] (CLK-789) SpringClickServlet injection fails if
"Page" class name starts with two or more upper case letters
Posted by "Naoki Takezoe (Commented) (JIRA)" <ji...@apache.org>.
[ https://issues.apache.org/jira/browse/CLK-789?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13257174#comment-13257174 ]
Naoki Takezoe commented on CLK-789:
-----------------------------------
Spring's AnnotationBeanNameGenerator generates the bean name for components which registered by annotation using Introspector#decapitalize().
So SpringClickServlet#toBeanName() should use it instead of the current implementation.
Index: extras/src/org/apache/click/extras/spring/SpringClickServlet.java
===================================================================
--- extras/src/org/apache/click/extras/spring/SpringClickServlet.java (revision 1308655)
+++ extras/src/org/apache/click/extras/spring/SpringClickServlet.java (working copy)
@@ -18,6 +18,7 @@
*/
package org.apache.click.extras.spring;
+import java.beans.Introspector;
import java.lang.reflect.Method;
import java.util.ArrayList;
import java.util.HashMap;
@@ -518,9 +519,7 @@
* @return the class bean name
*/
protected String toBeanName(Class<?> aClass) {
- String className = aClass.getName();
- String beanName = className.substring(className.lastIndexOf(".") + 1);
- return Character.toLowerCase(beanName.charAt(0)) + beanName.substring(1);
+ return Introspector.decapitalize(aClass.getSimpleName());
}
// Package Private Inner Classes ------------------------------------------
> SpringClickServlet injection fails if "Page" class name starts with two or more upper case letters
> --------------------------------------------------------------------------------------------------
>
> Key: CLK-789
> URL: https://issues.apache.org/jira/browse/CLK-789
> Project: Click
> Issue Type: Bug
> Components: core
> Affects Versions: 2.3.0
> Environment: Apache Tomcat 6.0.32 or 7.0.16. JRE 1.6.0_29 on Linux.
> Spring Framework 3.0.5.
> Reporter: Andrea Cozzolino
> Priority: Minor
> Labels: spring
>
> I am using SpringClickServlet to integrate Click with Spring.
> Spring injection in "Page" classes works only if the class name starts with exactly one upper case letter.
> If I have a class "ABTestPage" (that extends org.apache.click.Page and that is a @Component) when I try to use it, any @Resource is "null". If I rename the class to "AbTestPage", any @Resource is correctly injected.
> The following simple project demonstrates the problem: https://bitbucket.org/andcoz/clickspringuppercasebug/
--
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators: https://issues.apache.org/jira/secure/ContactAdministrators!default.jspa
For more information on JIRA, see: http://www.atlassian.com/software/jira