If 2 auto-wired beans are different types with same variable name, even in different composers, it causes "Injection of autowired dependencies failed;"
for example:
public class TestZKController extends GenericSpringComposer { @Autowired private Label testLabel; }
if there is another testLabel:
public class TestZKController2 extends GenericSpringComposer { @Autowired private Textbox testLabel; }
The exception will be like:
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'testZKCtrl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.zkoss.zul.Label org.zkoss.zkspringessentials.controller.TestZKController.name; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [org.zkoss.zul.Label] is defined: expected single matching bean but found 4: [someLbl, lastRanLbl, myLbl, testLabel] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1074) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:310) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1075) at org.zkoss.spring.init.CoreVariableResolver.resolveVariable(CoreVariableResolver.java:59) at org.zkoss.zkplus.spring.DelegatingVariableResolver.resolveVariable(DelegatingVariableResolver.java:99) at org.zkoss.xel.util.Evaluators.resolveVariable(Evaluators.java:192) at org.zkoss.zk.ui.impl.PageImpl.getXelVariable(PageImpl.java:523) at org.zkoss.zk.xel.impl.ExecutionResolver.resolveVariable(ExecutionResolver.java:190) at org.zkforge.apache.commons.el.Resolvers$1.resolve(Resolvers.java:36) at org.zkforge.apache.commons.el.Resolvers.resolve(Resolvers.java:58) at org.zkforge.apache.commons.el.NamedValue.evaluate(NamedValue.java:119) at org.zkforge.apache.commons.el.ExpressionEvaluatorImpl$JSTLExpression.evaluate(ExpressionEvaluatorImpl.java:518) at org.zkoss.xel.el.ELXelExpression.evaluate(ELXelExpression.java:45) at org.zkoss.zk.xel.impl.SimpleEvaluator.evaluate(SimpleEvaluator.java:68) at org.zkoss.zk.xel.ExValue.getValue(ExValue.java:101) at org.zkoss.zk.ui.metainfo.ComponentInfo.toComposers(ComponentInfo.java:365) at org.zkoss.zk.ui.metainfo.ComponentInfo.resolveComposer(ComponentInfo.java:352) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild0(UiEngineImpl.java:692) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:686) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:630) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreateChild(UiEngineImpl.java:662) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate0(UiEngineImpl.java:630) at org.zkoss.zk.ui.impl.UiEngineImpl.execCreate(UiEngineImpl.java:597) at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage0(UiEngineImpl.java:383) at org.zkoss.zk.ui.impl.UiEngineImpl.execNewPage(UiEngineImpl.java:306) at org.zkoss.zk.ui.http.DHtmlLayoutServlet.process(DHtmlLayoutServlet.java:225) at org.zkoss.zk.ui.http.DHtmlLayoutServlet.doGet(DHtmlLayoutServlet.java:146) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) at javax.servlet.http.HttpServlet.service(HttpServlet.java:820) at org.mortbay.jetty.servlet.ServletHolder.handle(ServletHolder.java:511) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1221) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:368) at org.zkoss.spring.security.ui.ZkLoginOKFilter.doFilter(ZkLoginOKFilter.java:136) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:109) at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.zkoss.spring.security.ui.ZkEnableSessionInvalidateFilter.doFilter(ZkEnableSessionInvalidateFilter.java:64) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:97) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:100) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:78) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:35) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:177) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:187) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.zkoss.spring.security.ui.ZkDisableSessionInvalidateFilter.doFilter(ZkDisableSessionInvalidateFilter.java:72) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.zkoss.spring.security.ui.ZkError403Filter.doFilter(ZkError403Filter.java:87) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:105) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:79) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.zkoss.spring.security.config.ZkDesktopReuseFilter.doFilter(ZkDesktopReuseFilter.java:119) at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:380) at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:169) at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:237) at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:167) at org.mortbay.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1212) at org.mortbay.jetty.servlet.ServletHandler.handle(ServletHandler.java:399) at org.mortbay.jetty.security.SecurityHandler.handle(SecurityHandler.java:216) at org.mortbay.jetty.servlet.SessionHandler.handle(SessionHandler.java:182) at org.mortbay.jetty.handler.ContextHandler.handle(ContextHandler.java:766) at org.mortbay.jetty.webapp.WebAppContext.handle(WebAppContext.java:450) at org.mortbay.jetty.handler.HandlerWrapper.handle(HandlerWrapper.java:152) at org.mortbay.jetty.Server.handle(Server.java:326) at org.mortbay.jetty.HttpConnection.handleRequest(HttpConnection.java:542) at org.mortbay.jetty.HttpConnection$RequestHandler.headerComplete(HttpConnection.java:928) at org.mortbay.jetty.HttpParser.parseNext(HttpParser.java:549) at org.mortbay.jetty.HttpParser.parseAvailable(HttpParser.java:212) at org.mortbay.jetty.HttpConnection.handle(HttpConnection.java:404) at org.mortbay.io.nio.SelectChannelEndPoint.run(SelectChannelEndPoint.java:410) at org.mortbay.thread.QueuedThreadPool$PoolThread.run(QueuedThreadPool.java:582)