2

在 spring 3.o 中,我正在尝试使用以下方法将我的 DAO 层对象注入到我的 singleTon bean:

ApplicationContext applicaionContext = new ClassPathXmlApplicationContext(ApplicationConstants.APP_PROPERTY_CONFIG_PATH);

        TemplateManagementDAO  templateManagementDAO =(TemplateManagementDAO) applicaionContext.getBean("templateManagementDAO");

但它给出了例外:

java.lang.NoClassDefFoundError: org.springframework.beans.FatalBeanException
    at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:581)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:983)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:879)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
    at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
    at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
    at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4655)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:5364)
    at com.sun.enterprise.web.WebModule.start(WebModule.java:345)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:986)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:970)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:704)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1649)
    at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1254)
    at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:182)
    at com.sun.enterprise.server.WebModuleDeployEventListener.moduleDeployed(WebModuleDeployEventListener.java:278)
    at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeModuleDeployEventListener(AdminEventMulticaster.java:1005)
    at com.sun.enterprise.admin.event.AdminEventMulticaster.handleModuleDeployEvent(AdminEventMulticaster.java:992)
    at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:470)
    at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:182)
    at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:308)
    at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:231)
    at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:298)
    at com.sun.enterprise.deployment.phasing.ApplicationStartPhase.runPhase(ApplicationStartPhase.java:132)
    at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:108)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:966)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:609)
    at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:653)
    at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.start(ApplicationsConfigMBean.java:773)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:390)
    at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:373)
    at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:477)
    at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
    at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
    at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:90)
    at $Proxy1.invoke(Unknown Source)
    at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:304)
    at com.sun.enterprise.interceptor.DynamicInterceptor.invoke(DynamicInterceptor.java:170)
    at com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:69)
    at com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:155)
    at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:122)
    at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:193)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:754)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
    at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:315)
    at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:287)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:218)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
    at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:94)
    at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:98)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:222)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
    at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
    at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
    at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1093)
    at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:291)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:666)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:597)
    at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:872)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
    at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
    at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:264)
    at com.sun.enterprise.web.connector.grizzly.WorkerThreadImpl.run(WorkerThreadImpl.java:117)

谁能建议我为什么不能将 DAO 对象访问到 bean 层?谢谢,Gunjan Shah。

4

5 回答 5

3

在您的application-context.xml定义中:

<bean id="templateManagementDAO" class="yourPackage.TemplateManagementDAO" />

注意TemplateManagementDAO应该是实现类而不是接口。

于 2012-04-26T13:05:06.957 回答
1

您需要先修复此异常

java.lang.NoClassDefFoundError: org.springframework.beans.FatalBeanException

这与任何 Spring 配置错误无关。你的类路径上有旧版本的 Spring 吗?

于 2012-04-26T13:12:56.840 回答
0

产生问题是因为我的应用程序初始化程序类在容器加载之前尝试访问 DAO。

所以在使用lazy-init = true 选项后它工作正常。

  <!-- LAZY LOAD THIS BEAN TO RESOLVE DAO INJECTION PROBLEM INTO THE BEAN -->
    <bean id="selStartUpDataInitializer" class="com.eks.sel.service.SELStartUpDataInitializer"
        factory-method="getInstance" lazy-init="true">
    </bean>

供您进一步参考,这是我使用 DAO 的类,从那里生成异常..

public class SELStartUpDataInitializer  implements Cloneable{

    private static SELStartUpDataInitializer selStartUpDataInitializer;
    private static final Logger LOGGER =Logger.getLogger(SELStartUpDataInitializer.class);
    private static Map<String,Object> staticContextMap = new HashMap<String, Object>(); 


    //PRIVATE CONSTRUCTOR : FOR SINGLE TON
    private SELStartUpDataInitializer(){                
        initializeTempalteDataFieldMap();
    }

    //OVERRIDE CLONNABLE METHOD
    @Override
    protected Object clone() throws CloneNotSupportedException {
        if(selStartUpDataInitializer==null){
            selStartUpDataInitializer = new SELStartUpDataInitializer();
        }
        return selStartUpDataInitializer;
    }


    //GET INSTANCE : USED BY BEAN TO INITIALIZE THE BEAN 
    public static synchronized SELStartUpDataInitializer getInstance(){
        if(selStartUpDataInitializer==null){
            selStartUpDataInitializer = new SELStartUpDataInitializer();
        }
        return selStartUpDataInitializer;
    }   



    //INITIALIZE TEMPALTE DATA FILEDs : CALLED BY ONE TIME CONSTRUCTOR
    public  void initializeTempalteDataFieldMap(){      
        LOGGER.info("SELStartUPDataInitializer ... Initializing all temaplte data mapping fields ....");
        Map<Integer, Map<String,String>> templateDatafieldMap = new HashMap<Integer, Map<String,String>>();
        LOGGER.info("Loading application contex from the class path : STARTED");
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext(ApplicationConstants.APP_RELOAD_PROPERTY_CONFIG_PATH);
        LOGGER.info("Loading application contex from the class path : COMPLETED");
        //ITS MANDATORY TO CAST BY INTERFACE. OTHERWISE $PROXY ERROR WILL BE GENERATED
        ITemplateManagementDAO  templateManagementDAO =(ITemplateManagementDAO) applicationContext.getBean("templateManagementDAO");                

        List<Template> templates = templateManagementDAO.findByStatus(1);
        LOGGER.info("initializeDataFields, number of templates = "+templates.size());

        for (Template template : templates) {
            String base64TffFile = ApplicationConstants.BASE64_PREFIX + 
                            new String(Base64.encodeBase64(template.getTemplateFile().getBytes()));

            LOGGER.info("initializeDataFields, initializing templateId = "+template.getTemplateid()+".");
            templateDatafieldMap.put(template.getTemplateid(), SELUtil.getDatafieldNames(base64TffFile));
            LOGGER.info("initializeDataFields, templateId = "+template.getTemplateid()+" initialized.");
        }

        IDynamicAttributeDAO dynamicAttributeDAO =(IDynamicAttributeDAO) applicationContext.getBean("dynamicAttributeDAO");

        staticContextMap.put(ApplicationConstants.TEMPLATE_DATAFIELD_MAP, templateDatafieldMap);
        staticContextMap.put(ApplicationConstants.ECC5_SAPTODATAFIELD_MAP,dynamicAttributeDAO.getAllSAPtoDataFieldAttribsMap(SAPConstants.SAP_ECC5));
        staticContextMap.put(ApplicationConstants.ECC6_SAPTODATAFIELD_MAP,dynamicAttributeDAO.getAllSAPtoDataFieldAttribsMap(SAPConstants.SAP_ECC6));
        staticContextMap.put(ApplicationConstants.ALL_DYNAMICATTRIBS_MAP,dynamicAttributeDAO.getAllDynamicAttributesMap());

    }


    public  Map<String, Object> getStaticContextMap() {
        return staticContextMap;
    }



}

在上面的课程中,我尝试使用 ClassPathXMLApplicationContext 重新加载/重新扫描 bean。所以这里的异常是在使用 DAO 时产生的。

在完全扫描配置并且初始化所有 bean 之前,它正在尝试检索 DAO。

于 2013-02-21T16:46:05.733 回答
0

我也有同样的例外。它提供的信息不多。通过大量调试,我发现在实例化 bean 时出现堆栈溢出异常。它是由使用 @Bean 注释的 2 个工厂方法之间的无休止的递归调用给出的。

这是它死前的堆栈跟踪,也许它发生在你身上,@Lazy 注释有助于避免这种情况......

"main" prio=10 tid=0x09151000 nid=0x4c10 runnable [0xf733b000]
   java.lang.Thread.State: RUNNABLE
        at com.cme.datamine.elephant.config.ElephantConfig.fileRouters(ElephantConfig.java:276)
        at com.cme.datamine.elephant.config.ElephantConfig$$EnhancerByCGLIB$$b38541f7.CGLIB$fileRouters$14(<generated>)
        at com.cme.datamine.elephant.config.ElephantConfig$$EnhancerByCGLIB$$b38541f7$$FastClassByCGLIB$$1e5bbc2f.invoke(<generated>)
        at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:215)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:280)
        at com.cme.datamine.elephant.config.ElephantConfig$$EnhancerByCGLIB$$b38541f7.fileRouters(<generated>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:149)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:570)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1015)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        - locked <0xe04f0fb8> (a java.util.concurrent.ConcurrentHashMap)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:292)
        at com.cme.datamine.elephant.config.ElephantConfig$$EnhancerByCGLIB$$b38541f7.fileRouters(<generated>)
        at com.cme.datamine.elephant.config.ElephantConfig.faultToleranceArbiter(ElephantConfig.java:302)
        at com.cme.datamine.elephant.config.ElephantConfig$$EnhancerByCGLIB$$b38541f7.CGLIB$faultToleranceArbiter$15(<generated>)
        at com.cme.datamine.elephant.config.ElephantConfig$$EnhancerByCGLIB$$b38541f7$$FastClassByCGLIB$$1e5bbc2f.invoke(<generated>)
        at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:215)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:280)
        at com.cme.datamine.elephant.config.ElephantConfig$$EnhancerByCGLIB$$b38541f7.faultToleranceArbiter(<generated>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:149)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:570)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1015)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        - locked <0xe04f0fb8> (a java.util.concurrent.ConcurrentHashMap)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:292)
        at com.cme.datamine.elephant.config.ElephantConfig$$EnhancerByCGLIB$$b38541f7.faultToleranceArbiter(<generated>)
        at com.cme.datamine.elephant.config.ElephantConfig.fileRouters(ElephantConfig.java:292)
        at com.cme.datamine.elephant.config.ElephantConfig$$EnhancerByCGLIB$$b38541f7.CGLIB$fileRouters$14(<generated>)
        at com.cme.datamine.elephant.config.ElephantConfig$$EnhancerByCGLIB$$b38541f7$$FastClassByCGLIB$$1e5bbc2f.invoke(<generated>)
        at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:215)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:280)
        at com.cme.datamine.elephant.config.ElephantConfig$$EnhancerByCGLIB$$b38541f7.fileRouters(<generated>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:149)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:570)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1015)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        - locked <0xe04f0fb8> (a java.util.concurrent.ConcurrentHashMap)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:292)
        at com.cme.datamine.elephant.config.ElephantConfig$$EnhancerByCGLIB$$b38541f7.fileRouters(<generated>)
        at com.cme.datamine.elephant.config.ElephantConfig.writersRunners(ElephantConfig.java:256)
        at com.cme.datamine.elephant.config.ElephantConfig$$EnhancerByCGLIB$$b38541f7.CGLIB$writersRunners$13(<generated>)
        at com.cme.datamine.elephant.config.ElephantConfig$$EnhancerByCGLIB$$b38541f7$$FastClassByCGLIB$$1e5bbc2f.invoke(<generated>)
        at net.sf.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:215)
        at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:280)
        at com.cme.datamine.elephant.config.ElephantConfig$$EnhancerByCGLIB$$b38541f7.writersRunners(<generated>)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:149)
        at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:570)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1015)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        - locked <0xe04f0fb8> (a java.util.concurrent.ConcurrentHashMap)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:848)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:790)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:284)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
        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$1.getObject(AbstractBeanFactory.java:294)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        - locked <0xe04f0fb8> (a java.util.concurrent.ConcurrentHashMap)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:848)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:790)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)
        at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)
        at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:284)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
        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$1.getObject(AbstractBeanFactory.java:294)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
        - locked <0xe04f0fb8> (a java.util.concurrent.ConcurrentHashMap)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:585)
        - locked <0xe04f1df0> (a java.util.concurrent.ConcurrentHashMap)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:913)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:464)
        - locked <0xe04f1eb0> (a java.lang.Object)
        at com.cme.datamine.elephant.launch.Launcher.createSpringContext(Launcher.java:109)
        at com.cme.datamine.elephant.launch.Launcher.main(Launcher.java:55)
于 2013-02-15T14:16:51.853 回答
0

在您的 Spring Context 配置文件中,如果您已激活包扫描以基于 annotations () 发现 bean,您也可以使用 @Repository 注释您的 DAO 类。

于 2012-04-26T13:17:32.333 回答