Spring-data-redis我在注入redisTemplate报错是不是SPring的版本不对 10C

图片说明

,是不是SPring的版本不对,这是个老项目,spirng应该是3.0.3

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: protected org.springframework.data.redis.core.RedisTemplate com.common.redis.dao.AbstractRedisBaseDao.redisTemplate; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisTemplate' defined in class path resource [com/common/redis/RedisConfiguration.class]: Instantiation of bean failed; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Factory method [public org.springframework.data.redis.core.StringRedisTemplate com.common.redis.RedisConfiguration.redisTemplate()] threw exception; nested exception is java.lang.NoClassDefFoundError: org/springframework/core/serializer/support/SerializingConverter
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1064)
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: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:574)
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:4745)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5207)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)
at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1739)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:482)
at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:431)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)
at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)
at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)
at javax.management.remote.rmi.RMIConnectionImpl.doOperation(RMIConnectionImpl.java:1487)
at javax.management.remote.rmi.RMIConnectionImpl.access$300(RMIConnectionImpl.java:97)
at javax.management.remote.rmi.RMIConnectionImpl$PrivilegedOperation.run(RMIConnectionImpl.java:1328)
at javax.management.remote.rmi.RMIConnectionImpl.doPrivilegedOperation(RMIConnectionImpl.java:1420)
at javax.management.remote.rmi.RMIConnectionImpl.invoke(RMIConnectionImpl.java:848)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:322)
at sun.rmi.transport.Transport$2.run(Transport.java:202)
at sun.rmi.transport.Transport$2.run(Transport.java:199)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:198)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:567)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run0(TCPTransport.java:828)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.access$400(TCPTransport.java:619)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:684)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler$1.run(TCPTransport.java:681)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:681)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)

2个回答

应该是spring的版本过低了,spring-data-redis依赖的最低spring版本也是3.1.1起步

说错了不好意思,应该是3.1.0起步,你可以去http://mvnrepository.com/查看一下他们的依赖关系

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
Spring项目中Spring-data-redis的RedisTemplate @Autowared注入为空
[b]最近在学习Spring整合redis,配置了一个项目启动时报错,请各位大神看一下,谢谢啦:[/b]rn[code=text]rn20-Mar-2017 15:33:18.291 INFO [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContext20-Mar-2017 15:33:12.293 INFO [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.ApplicationContext.log No Spring WebApplicationInitializer types detected on classpathrn20-Mar-2017 15:33:12.324 INFO [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.ApplicationContext.log Initializing Spring root WebApplicationContextrn20-Mar-2017 15:33:18.281 SEVERE [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.StandardContext.listenerStart Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListenerrn org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'redisUserDAO' defined in file [/home/ob/Projects/im-system/im-server/build/libs/exploded/im-service-1.0.0.war/WEB-INF/classes/com/xxx/im/dao/redis/RedisUserDAO.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.xxx.im.dao.redis.RedisUserDAO]: Constructor threw exception; nested exception is java.lang.NullPointerExceptionrn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1116)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1060)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:513)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:759)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:866)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)rn at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:444)rn at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:326)rn at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:107)rn at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4717)rn at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5179)rn at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)rn at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:752)rn at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:728)rn at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:734)rn at org.apache.catalina.startup.HostConfig.manageApp(HostConfig.java:1702)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)rn at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)rn at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)rn at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:456)rn at org.apache.catalina.mbeans.MBeanFactory.createStandardContext(MBeanFactory.java:405)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)rn at java.lang.reflect.Method.invoke(Method.java:498)rn at org.apache.tomcat.util.modeler.BaseModelMBean.invoke(BaseModelMBean.java:300)rn at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:819)rn at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:801)rn rn at java.lang.Thread.run(Thread.java:745)rnCaused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [com.xxx.im.dao.redis.RedisUserDAO]: Constructor threw exception; nested exception is java.lang.NullPointerExceptionrn at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:154)rn at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1108)rn ... 58 morernCaused by: java.lang.NullPointerExceptionrn at com.xxx.im.dao.redis.RedisBaseDAO.getKeySerializer(RedisBaseDAO.java:28)rn at com.xxx.im.dao.redis.RedisUserDAO.(RedisUserDAO.java:20)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)rn at java.lang.reflect.Constructor.newInstance(Constructor.java:423)rn at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:142)rn ... 60 morernrn20-Mar-2017 15:33:18.291 INFO [RMI TCP Connection(2)-127.0.0.1] org.apache.catalina.core.ApplicationContext.log Closing Spring root WebApplicationContextrn[/code]rnrnspring配置:rn1. spring-config.xmlrn[code=html]rnrnrnrnrn rnrn rn rnrn rnrn rn rnrn[/code]rnrn2. spring-config-redis文件rn[code=html]rnrnrnrn rn rn rnrn rn rn rnrn rn rnrn[/code]rnrn出错位置代码rnrn[code=java]rnpackage com.xxx.im.dao.redis;rnrnimport org.springframework.beans.factory.annotation.Autowired;rnimport org.springframework.data.redis.core.ListOperations;rnimport org.springframework.data.redis.core.RedisTemplate;rnimport org.springframework.data.redis.serializer.RedisSerializer;rnrnimport javax.annotation.Resource;rnrn/**rn * Created by xx on 17-3-17.rn */rnpublic abstract class RedisBaseDAO rnrn @Autowiredrn protected RedisTemplate redisTemplate;rnrn public void setRedisTemplate(RedisTemplate redisTemplate) rn this.redisTemplate = redisTemplate;rn rnrn protected RedisSerializer getKeySerializer()rn return (RedisSerializer) redisTemplate.getKeySerializer();rn rnrn protected RedisSerializer getValueSerializer()rn return (RedisSerializer) redisTemplate.getValueSerializer();rn rnrn[/code]rnrn调试截图rn[img=https://img-bbs.csdn.net/upload/201703/20/1489997912_450016.png][/img]rnrn请各位大神帮忙看一下,谢谢啦!!!
是不是版本不对?
这是网上下载的代码,运行出错:rnrn找不到文件或程序集名称“Microsoft.Web.UI.WebControls.resources”,或找不到它的一个依赖项。 rn说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 rnrn异常详细信息: System.IO.FileNotFoundException: 找不到文件或程序集名称“Microsoft.Web.UI.WebControls.resources”,或找不到它的一个依赖项。rnrnrn帮忙指点一下,大概什么地方出了问题?
静态redisTemplate的注入
静态redisTemplate的注入
spring 注入失败报错
报错代码片段: Error creating bean with name 'itemServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire...
Spring 自动注入报错
哪位大侠给瞅瞅啊rnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: richeninfo.dao.UserMapper richeninfo.service.UserService.userMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [richeninfo.dao.UserMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: @org.springframework.beans.factory.annotation.Autowired(required=true)rnRelated cause: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userMapper' defined in file [D:\sts\configSystem\target\classes\richeninfo\dao\UserMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-mybatis.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\sts\configSystem\target\classes\richeninfo\mapping\UserMapper.xml]'; nested exception is java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving JdbcType. Cause: java.lang.IllegalArgumentException: No enum const class org.apache.ibatis.type.JdbcType.Integerrn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1120)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:607)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:93)rn at richeninfo.test.UserTest.findUser(UserTest.java:24)rn at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)rn at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)rn at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)rn at java.lang.reflect.Method.invoke(Method.java:597)rn at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(FrameworkMethod.java:47)rn at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)rn at org.junit.runners.model.FrameworkMethod.invokeExplosively(FrameworkMethod.java:44)rn at org.junit.internal.runners.statements.InvokeMethod.evaluate(InvokeMethod.java:17)rn at org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:271)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:70)rn at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:50)rn at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)rn at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)rn at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)rn at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)rn at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)rn at org.junit.runners.ParentRunner.run(ParentRunner.java:309)rn at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:46)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:467)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:683)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:390)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:197)rnCaused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: richeninfo.dao.UserMapper richeninfo.service.UserService.userMapper; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [richeninfo.dao.UserMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: @org.springframework.beans.factory.annotation.Autowired(required=true)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:514)rn at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:285)rn ... 36 morernCaused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [richeninfo.dao.UserMapper] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: @org.springframework.beans.factory.annotation.Autowired(required=true)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:949)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:818)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:730)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:486)rn ... 38 morernRelated cause:rnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userMapper' defined in file [D:\sts\configSystem\target\classes\richeninfo\dao\UserMapper.class]: Cannot resolve reference to bean 'sqlSessionFactory' while setting bean property 'sqlSessionFactory'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [spring-mybatis.xml]: Invocation of init method failed; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [D:\sts\configSystem\target\classes\richeninfo\mapping\UserMapper.xml]'; nested exception is java.lang.RuntimeException: Error parsing Mapper XML. Cause: org.apache.ibatis.builder.BuilderException: Error resolving JdbcType. Cause: java.lang.IllegalArgumentException: No enum const class org.apache.ibatis.type.JdbcType.Integerrn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:329)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:107)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1391)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1132)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:522)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:461)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getTypeForFactoryBean(AbstractBeanFactory.java:1357)rn
spring mvc 注入报错
错误信息如下:rnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uploadController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.service.UploadService com.controller.UploadController.uploadService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uploadService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.dao.UploadDao com.service.UploadService.uploadDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uploadDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.jdbc.core.JdbcTemplate com.dao.UploadDao.jdbcTemplate; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.jdbc.core.JdbcTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: @org.springframework.beans.factory.annotation.Autowired(required=true)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:772)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:834)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:537)rn at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:667)rn at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:633)rn at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:681)rn at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:552)rn at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:493)rn at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)rn at javax.servlet.GenericServlet.init(GenericServlet.java:158)rn at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1231)rn at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1144)rn at org.apache.catalina.core.StandardWrapper.allocate(StandardWrapper.java:817)rn at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:135)rn at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)rn at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)rn at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:142)rn at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)rn at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)rn at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)rn at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:518)rn at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1091)rn at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:673)rn at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)rn at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)rn at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)rn at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)rn at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)rn at java.lang.Thread.run(Thread.java:745)rnCaused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.service.UploadService com.controller.UploadController.uploadService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uploadService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.dao.UploadDao com.service.UploadService.uploadDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uploadDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.jdbc.core.JdbcTemplate com.dao.UploadDao.jdbcTemplate; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.jdbc.core.JdbcTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: @org.springframework.beans.factory.annotation.Autowired(required=true)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:571)rn at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)rn ... 36 morernCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uploadService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.dao.UploadDao com.service.UploadService.uploadDao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'uploadDao': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.jdbc.core.JdbcTemplate com.dao.UploadDao.jdbcTemplate; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [org.springframework.jdbc.core.JdbcTemplate] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: @org.springframework.beans.factory.annotation.Autowired(required=true)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1214)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:543)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:482)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:305)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:301)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:196)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.findAutowireCandidates(DefaultListableBeanFactory.java:1145)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:1069)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:967)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:543)rn ... 38 morern....
spring 循环注入报错
2019-01-21 17:17:51,705 ERROR [org.springframework.web.context.ContextLoader] - Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 't...
Spring 注入报错
下面的是接口类和实现类public interface CompactDisc { void play(); }public class SgtPeppers implements CompactDisc{ private String name="1 number"; private String title="xiulianaiqing"; public voi
redisTemplate 注入 一直报null
redisTemplate 一直报null 没有注入进来,
spring-data-redis
spring-data-redis jar包
Spring boot 启动报错版本不对
发现session store type使用来存放session的存储方式,目前Spring boot中只支持Redis方式。 由于本应用暂无需将session放入redis的需求,故这里就可以将session store type设置为none. 这里我们将此配置信息放入application.properites之中: spring.session.store-type=none 再次启动,成...
Spring 注入实现类报错问题
在使用spring 时,假如在controller中注入了impl 实现类可能会出现报错的情况。 为什么是“可能”,① 假如没用使用spring aop ,则不会报错。                             ② 类没用使用接口也不会报错。 1、为什么使用 aop 会导致报错:       spring aop的实现是基于动态代理       如果目标对象实现了接口,那么...
hibernate spring 自动注入报错
- Context initialization failed org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityManager': Autowiring of methods failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.javaeye.sample.security.support.SecurityManagerSupport.init(org.hibernate.SessionFactory); nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in ServletContext resource [/WEB-INF/classes/applicationContext-dataAccess.xml]: Invocation of init method failed; nested exception is java.lang.NoSuchFieldError: tableNameBindingrn  rn  rn 这个错误大家有没有见过呢?我查了半天,没找到合适的解决方案
spring 注入静态变量 报错 no property
功能描述: 发送短信工具类:该工具类定义了静态发短信的方法,所有使用的用户名,密码都需要定义为静态,这里需要通过spring 读取配置文件注入 首先定义静态变量: private static String host=""; private static String username=""; private static String pass...
JUnit测试 spring 注入 问题报错
Junit 代码rn[code=java]@RunWith(SpringJUnit4ClassRunner.class)rn@ContextConfiguration(locations = "classpath*:/config/srping/core-root-context.xml", "classpath*:/config/srping/orm-context.xml" )rnpublic class moitorTest rn private MoitorServiceI moitorService;rn public MoitorServiceI getMoitorService() rn return moitorService;rn rn @Autowiredrn //@Resource(name="moitorService") rn public void setMoitorService(MoitorServiceI moitorService) rn this.moitorService = moitorService;rn rn @Testrn public void test1() rn rnrn[/code]rnrn接口与实现类rn[code=java]@Service("moitorService")rnpublic class MoitorServiceImpl implements MoitorServiceI rnrn private ParkingMoitorLogMapper parkingMoitorLogMapper;rnrn @Overridern public List getMoitorLogByParkingCodeAndStartTime(String parkingCode, String startTime) rnrn //return null;rn return parkingMoitorLogMapper.getMoitorLogByParkingCodeAndStartTime(parkingCode, startTime);rn rnrnpublic interface MoitorServiceI rn /**rn * Description: 获取错误日志信息 rn * rn * @author rn * @taskId rn * @param ParkingCodern * rn * @param StartTimern * rn * @return rn */rn List getMoitorLogByParkingCodeAndStartTime(String parkingCode, String startTime);rnrn[/code]rnrnrnspring 配置中 扫描路径rn[code=text] rn rn[/code]rnrn启动之后报错 无法实现注入,找不到接口对应的实现类rn[code=text] org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.huibo.parking.moitor.moitorTest': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.huibo.parking.moitor.moitorTest.setMoitorService(com.huibo.parking.moitor.service.MoitorServiceI); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.huibo.parking.moitor.service.MoitorServiceI] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:289)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1146)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:376)rn at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:110)rn at org.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)rn at org.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)rn at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.createTest(SpringJUnit4ClassRunner.java:211)rn at org.springframework.test.context.junit4.SpringJUnit4ClassRunner$1.runReflectiveCall(SpringJUnit4ClassRunner.java:288)rn at org.junit.internal.runners.model.ReflectiveCallable.run(ReflectiveCallable.java:12)rn at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.methodBlock(SpringJUnit4ClassRunner.java:284)rn at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:231)rn at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.runChild(SpringJUnit4ClassRunner.java:88)rn at org.junit.runners.ParentRunner$3.run(ParentRunner.java:238)rn at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:63)rn at org.junit.runners.ParentRunner.runChildren(ParentRunner.java:236)rn at org.junit.runners.ParentRunner.access$000(ParentRunner.java:53)rn at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:229)rn at org.springframework.test.context.junit4.statements.RunBeforeTestClassCallbacks.evaluate(RunBeforeTestClassCallbacks.java:61)rn at org.springframework.test.context.junit4.statements.RunAfterTestClassCallbacks.evaluate(RunAfterTestClassCallbacks.java:71)rn at org.junit.runners.ParentRunner.run(ParentRunner.java:309)rn at org.springframework.test.context.junit4.SpringJUnit4ClassRunner.run(SpringJUnit4ClassRunner.java:174)rn at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)rn at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:538)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:760)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:460)rn at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:206)rnCaused by: org.springframework.beans.factory.BeanCreationException: Could not autowire method: public void com.huibo.parking.moitor.moitorTest.setMoitorService(com.huibo.parking.moitor.service.MoitorServiceI); nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.huibo.parking.moitor.service.MoitorServiceI] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:604)rn at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:286)rn ... 26 morernCaused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type [com.huibo.parking.moitor.service.MoitorServiceI] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:993)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:863)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:775)rn at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredMethodElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)rn ... 28 more[/code]rnrnrn我感觉 应该没有啥问题,看不出所以然,特此求助!rnrn百度了 有人说接口 与实现类 同目录 我也是同目录下rnrn
spring ioc参数注入报错
org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 24 in XML document from class path resource [applicationContext.xml] is invalid; nested exception is org.xml.sax.SAXParseExc
Spring boot注入多个redisTemplate,并更改默认序列化策略
1、添加maven依赖        <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-redis</artifactId> </dependency>2、配置文件中...
是不是全局函数调用不对导致的这个报错??
SerialPortAPIDlg.cpprnLinking...rnSerialPortAPIDlg.obj : error LNK2001: unresolved external symbol "unsigned long __stdcall SerialPort1ThreadProcess(struct HWND__ *)" (?SerialPort1ThreadProcess@@YGKPAUHWND__@@@Z)rnDebug/SerialPortAPI.exe : fatal error LNK1120: 1 unresolved externalsrnError executing link.exe.rnrnrn rn在SerialPortControl.CPP文件中定义的,rn在调用SerialPort1ThreadProcess的文件中#include "SerialPortControl.h"了头文件,并且SerialPortControl.h中申明了这个全局函数!rnextern DWORD WINAPI SerialPort1ThreadProcess(HWND hWnd);
redistemplate
redis client, 用下看看吧.
Spring 篇:RedisTemplate 配置与使用
Maven 依赖 <!-- Redis 官方提供的 Java 驱动 --> <dependency> <groupId>redis.clients</groupId> <artifactId>jedis</artifactId> <version>2.9.0
SQL注入--报错注入
一个带get参数的网站并且不从数据库返回数据,但存在报错信息 http://127.0.0.1/index.php?id=1 http://127.0.0.1/index.php?id=1' 查看字段情况: http://127.0.0.1/index.php?id=1' order by 3%23 http://127.0.0.1/index.php?id=1'
SQL注入-报错注入
报错注入原理 根据注入位置数据类型可将SQl注入分为两类:数字型和字符型。 例如: 数字型:select * from table where id=用户id 字符型:select * from table where id=‘用户id’ 通过在URL中修改对应的ID值,为正常数字、大数字、字符(单引号、双引号、双单引号、括号)、反斜杠\来探测URl中是否存在注入点。 构造payload让信息通过...
Spring RedisTemplate操作-String操作
package com.panku.web.redis; import java.util.Arrays; import java.util.HashMap; import java.util.Map; import java.util.concurrent.TimeUnit; import javax.annotation.Resource; import org.junit
基于spring的redisTemplate的缓存工具类
  1、spring相关配置如下: <bean id="jedisPoolConfig" class="redis.clients.jedis.JedisPoolConfig"> <property name="maxIdle" value="${redis.pool.maxIdle}" /> <!-- 最大能够保持idel状态的对象
SQL注入之报错注入
报错注入通过floor报错注入 固定语句公式 union select 1 from (select+count(*),concat(floor(rand(0)*2),(注入爆数据语句))a from information_schema.tables group by a)b 例子假如id输入存在注入的话,可以通过如下语句进行报错。 mysql> select * from arti
SpringBoot中注入RedisTemplate实例异常解决
项目注入如图所示,报错 解决方法:将@Autowired改为@Resource 或者将泛型去掉 原因:RedisTemplate< String, Object>注入时用到了@Autowired,@Autowired默认按照类型装配的。也就是说,想要获取RedisTemplate< String, Object>的Bean,要根据名字装配。使用@R...
spring报错,加了jar包也不对
![图片说明](https://img-ask.csdn.net/upload/201809/28/1538114737_227900.png) rn 九月 28, 2018 2:04:52 下午 org.springframework.context.support.AbstractApplicationContext prepareRefreshrn信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@b1a58a3: startup date [Fri Sep 28 14:04:52 CST 2018]; root of context hierarchyrn九月 28, 2018 2:04:52 下午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitionsrn信息: Loading XML bean definitions from class path resource [spring-aop.xml]rn九月 28, 2018 2:04:52 下午 org.springframework.context.support.AbstractApplicationContext refreshrn警告: Exception encountered during context initialization - cancelling refresh attemptrnorg.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0': Cannot resolve reference to bean 'pointcut' while setting bean property 'pointcut'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pointcut': Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/util/TypeSafeEnumrn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1477)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1222)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)rn at com.spring.test.Test.main(Test.java:10)rnCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pointcut': Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/util/TypeSafeEnumrn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1101)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)rn ... 15 morernCaused by: java.lang.NoClassDefFoundError: org/aspectj/util/TypeSafeEnumrn at java.lang.ClassLoader.defineClass1(Native Method)rn at java.lang.ClassLoader.defineClass(Unknown Source)rn at java.security.SecureClassLoader.defineClass(Unknown Source)rn at java.net.URLClassLoader.defineClass(Unknown Source)rn at java.net.URLClassLoader.access$100(Unknown Source)rn at java.net.URLClassLoader$1.run(Unknown Source)rn at java.net.URLClassLoader$1.run(Unknown Source)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at org.springframework.aop.aspectj.AspectJExpressionPointcut.(AspectJExpressionPointcut.java:87)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)rn at java.lang.reflect.Constructor.newInstance(Unknown Source)rn at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)rn at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1094)rn ... 21 morernCaused by: java.lang.ClassNotFoundException: org.aspectj.util.TypeSafeEnumrn at java.net.URLClassLoader.findClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn ... 41 morernrnException in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0': Cannot resolve reference to bean 'pointcut' while setting bean property 'pointcut'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pointcut': Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/util/TypeSafeEnumrn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:359)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:108)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1477)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1222)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)rn at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:303)rn at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:299)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)rn at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:755)rn at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:757)rn at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:480)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)rn at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)rn at com.spring.test.Test.main(Test.java:10)rnCaused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'pointcut': Instantiation of bean failed; nested exception is java.lang.NoClassDefFoundError: org/aspectj/util/TypeSafeEnumrn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1101)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1046)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:504)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)rn at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:322)rn at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)rn at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:351)rn ... 15 morernCaused by: java.lang.NoClassDefFoundError: org/aspectj/util/TypeSafeEnumrn at java.lang.ClassLoader.defineClass1(Native Method)rn at java.lang.ClassLoader.defineClass(Unknown Source)rn at java.security.SecureClassLoader.defineClass(Unknown Source)rn at java.net.URLClassLoader.defineClass(Unknown Source)rn at java.net.URLClassLoader.access$100(Unknown Source)rn at java.net.URLClassLoader$1.run(Unknown Source)rn at java.net.URLClassLoader$1.run(Unknown Source)rn at java.security.AccessController.doPrivileged(Native Method)rn at java.net.URLClassLoader.findClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at org.springframework.aop.aspectj.AspectJExpressionPointcut.(AspectJExpressionPointcut.java:87)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)rn at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)rn at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)rn at java.lang.reflect.Constructor.newInstance(Unknown Source)rn at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)rn at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:89)rn at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:1094)rn ... 21 morernCaused by: java.lang.ClassNotFoundException: org.aspectj.util.TypeSafeEnumrn at java.net.URLClassLoader.findClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)rn at java.lang.ClassLoader.loadClass(Unknown Source)rn ... 41 more
SQL注入我写的怎么不对呢?
编译错误 rn说明: 在编译向该请求提供服务所需资源的过程中出现错误。请检查下列特定错误详细信息并适当地修改源代码。 rnrn编译器错误信息: CS0120: 非静态的字段、方法或属性“System.Data.OleDb.OleDbCommand.Parameters.get”要求对象引用rnrn源错误:rnrn rn行 134:rn行 135: OleDbCommand.Parameters.Add(new OleDbParameter("@loginName", OleDbType.NVarChar, 20));rn行 136: OleDbCommand.Parameters["@loginName"].Value = this.UserName.Text;rnrn rn
关于spring 注入......................我希望
rn rn rn rn rnrnrn其中rn rn rn rnrn这个类也需要注入一个类我应该怎么写啊?rnrnrnrn rn rn rn rn rn rn rn rnrnrnrnrn不知道说没说清楚啊rnrn
spring 注入 动态注入
spring 注入: 1,配置文件注入      (一)bean            <bean id="securityManager" class="org.apache.shiro.web.mgt.DefaultWebSecurityManager"> <property name="realm" ref="authenticationRealm" /&g
【小家Spring】Spring Boot中使用RedisTemplate优雅的操作Redis,并且解决RedisTemplate泛型注入失败的问题
前言 Spring为了简化我们对持久化层的操作,针对各种持久化方案提供了统一的Template进行操作。比如我们的熟悉的JdbcTemplate就是让我们方便的操作的关系型数据库的。 它有个Spring-Data的子项目,提供了各种SQL、NOSql的便捷操作。比如Redis、MongoDB、ES等等。然后本文主要针对于在SpringBoot中使用RedisTemplate来优雅的操作Redis数...
版本不对
在建VB.NET的WEB 应用程序时,提示ASP.NET 1.1与IIS 1.0的版本不对.rn重装过IIS,用aspnet_regiis -i注册过,还是不行.rn不知什么原因rnrn请问各位高手rn
使用spring注解注入,测试一直报错
在使用spring注解注入实例的时候,一直包一个[color=red]org.springframework.beans.factory.BeanCreationException[/color]的错误,具体错误代码如第一张rnapplication配置如第二张。rn需要注入实体的类,第三张rn测试代码第四张,注解部分是用的[color=red]ApplicationContext[/color]注入的可以正常使用,现在改成注解方式了 就报这个错误,纠结好几天了,急死人了,这个是我简单写了例子,复杂代码就没提出来。但是问题就是这个。注解注入就报错。
exp报错注入和updatexml报错注入
前言 做了实验吧一个题,由于过滤比较多,学了两种新接触的报错注入。一下为总结,以便复习,查看,也作为萌新间的分享交流吧。 学习笔记 UpdateXml() MYSQL显错注入 在学习之前,需要先了解 UpdateXml() 。 UPDATEXML (XML_document, XPath_string, new_value); 第一个参数:XML_d...
报错注入
报错注入一般流程 报错注入的五种函数 全部都以查user()为例子~ floor() id = 1 and (select 1 from (select count(*),concat(version(),floor(rand(0)*2))x from information_schema.tables group by x)a) extractvalue() id = 1 and ...
我是不是配置的不对?还是语法问题
用C++ dev编译程序时程序开头写“using std::cin”编译提示`cin' not declaredrn
是不是我的CString建的不对呀
首先我生成一个CString rn CString CTestDlg::CreateRandString(int length)rnrn rn int i=0;rn CString temp="";rn CString last="";rn char createrand[1];rn srand(unsigned(time(NULL)));rn for(int m=0;mCardPasswordString;rn vector::iterator CardPasswordStringIter; rn CardNumberString.push_back(temppass);rn然后取出放入文件中rnrn for(CardPasswordStringIter=CardPasswordString.begin();CardPasswordStringIter!=CardPasswordString.end();)rnrnrn CString temp_e=((CString)*CardPasswordStringIter);rn ar.WriteString(temp_e);//sr为CArchive类rnrn为什么写入文件后无论VECTOR多少长,temp_e都为同一值,而且不是我生成的随机数,而是不知道那里出来的一个数,是不是我的CString建的不对呀,但是单步跟踪取出的temp_e是对的呀,请问高手是为什么?rn例如输出如下,第一列都为一样,但长度是对的rn8132730621 00000003rn8132730621 00000004rn8132730621 00000005rn8132730621 00000006rn8132730621 00000007rn8132730621 00000008rn8132730621 00000009rn8132730621 00000010rn8132730621 00000011rn8132730621 00000012rn8132730621 00000013rn8132730621 00000014rn8132730621 00000015rn8132730621 00000016rn8132730621 00000017rn
session我是不是用的不对?请帮忙!
session对象我有点不会用,为了防止刷新又提交表单的情况发生,我是这样写的:rn<% rn if session("flag")=0 thenrn session("flag")=1 rn lname=request("lname")rn ename=request("ename")rn email=request("email")rn text=request("text")rn rrtime=now()rn uip=request.ServerVariables("REMOTE_HOST")rn llname=trim(lname)rn if llname<>"" thenrn conn.execute("insert into [mimi](lname,ename,email,text,rtime,ip)values('"&lname&"','"&ename&"','"&email&"','"&text&"','"&rrtime&"','"&uip&"')")rn end ifrn elsern session("flag")=0rn response.Write(" ")rn end ifrn %>rnrn为什么这里的session只起到一个变量的作用 不是她本身具有的作用,就是刷新二遍就又提交一次,session该如何使用呢? 请教, 谢谢!
我这样写是不是不对?帮我看看
sl 是数量 gmjg 是购买价格rnrnADODB.Recordset 错误 '800a0cc1' rn项目在所需的名称或序数中未被发现。 rn/huizong_1.asp,行109 rnrnrnrn<%rnsqbm=request.form("t1")rnset conn=server.createobject("adodb.connection")rnconn.open "driver=microsoft access driver (*.mdb);dbq="&server.mappath("data.mdb")rnexec="select sqbm,sqsj,wpmc,ggxh,dw,sl,gmjg,sl*gmjg from zhb where sqbm='"&sqbm&"'and sfly=false and sfdh=true"rnset rs=server.createobject("adodb.recordset")rnrs.open exec,conn,1,1rn%>rnrnrnrn rn rn rn New Page 1rnrnrnrnrn<% if rs.eof then %>rnrn rn rn rn rn rn rn <%=response.write("您所查询的部门信息不存在")%>rn rn rn rn rn rn rn rn rn rn rnrn <% response.end '加上为好rn end ifrn %>rnrnrn rn rn rn rn rn rn <%=rs("sqbm")%>汇总表rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrn rn rn 部门rn rn 申请时间rn rn 物品名称rn rn 规格型号rn rn 单位rn rn 数量rn rn 单价(元)rn rn 总价(元)rn rn rnrn <%for b=1 to rs.pagesizern if rs.eof thenrn exit forrn end ifrn%>rn rn <%=rs("sqbm")%>rn <%=rs("sqsj")%>rn <%=rs("wpmc")%>rn <%=rs("ggxh")%>rn <%=rs("dw")%>rn <%=rs("sl")%>rn <%=rs("gmjg")%>rn <%=rs("sl*gmjg")%>rn rn <% rnrs.movenextrnnextrn%>rnrnrn rn rn rn rn rn rn 注:Flase=否 True=是rn rn rn rn rnrnrn rn rn rn rn rn rn rn rn rn rn rn rn rn rn rnrnrnrnrnrn
【Spring】--Spring方法注入
通常我们在程序中会使用new关键字来实现一个类依赖于另一个类,这样虽然可以实现需求。但是也存在一个问题,就是不容易统一管理。而Spring提出了依赖注入的思想,使用Spring容器来进行注入,也称为控制反转。   常用的注入方法有两种:构造函数法和set注入    1、构造函数法      在需要注入的java类中创建构造函数,如下:      package com.tgb.spring
相关热词 c++和c#哪个就业率高 c# 批量动态创建控件 c# 模块和程序集的区别 c# gmap 截图 c# 验证码图片生成类 c# 再次尝试 连接失败 c#开发编写规范 c# 压缩图片好麻烦 c#计算数组中的平均值 c#获取路由参数