糖果派对官方网站_可以赌钱的糖果游戏_手机版
bb电子糖果派对任何时候书本上学spring,遭遇Injection of autowired dependencies failed,央浼大佬援救看看

bb电子糖果派对任何时候书本上学spring,遭遇Injection of autowired dependencies failed,央浼大佬援救看看

作者:操作系统    来源:未知    发布时间:2020-01-21 22:07    浏览量:

bb电子糖果派对 1

bb电子糖果派对,自己是用IDEA制造的MAVEN项目,布局如下然后在dao层userDao

@RepositorypublicclassUserDao{@AutowiredprivateJdbcTemplatejdbcTemplate;publicintgetMatchCount(StringuserName,Stringpassword){StringsqlStr="SELECTcount(*)FROMt_user"+"WHEREuser_name=?andpassword=?";returnjdbcTemplate.queryForInt(sqlStr,newObject[]{userName,password});}

LoginLogDao

@RepositorypublicclassLoginLogDao{@AutowiredprivateJdbcTemplatejdbcTemplate;publicvoidinsertLoginLog(LoginLogloginLog){StringsqlStr="INSERTINTOt_login_log(user_id,ip,login_datetime)"+"VALUES(?,?,?)";Object[]args={loginLog.getUserId(),loginLog.getIp(),loginLog.getLoginDate()};jdbcTemplate.update(sqlStr,args);}

service层UserService

@ServicepublicclassUserService{@AutowiredprivateUserDaouserDao;@AutowiredprivateLoginLogDaologinLogDao;publicbooleanhasMatchUser(StringuserName,Stringpassword){intmatchCount=userDao.getMatchCount(userName,password);returnmatchCount0;}publicvoidloginSuccess(Useruser){LoginLogloginLog=newLoginLog();loginLog.setUserId(user.getUserId());loginLog.setIp(user.getLastIp());loginLog.setLoginDate(user.getLastVisit());loginLogDao.insertLoginLog(loginLog);}

下一场使用testng对userservice下的不二秘诀举行测验UserServiceTest

@ContextConfiguration(locations={"/applicationContext*.xml"})publicclassUserServiceTestextendsAbstractTestNGSpringContextTests{@AutowiredprivateUserServiceuserService;@TestpublicvoidhasMatchUser(){booleanb1=userService.hasMatchUser("admin","123456");booleanb2=userService.hasMatchUser("admin","1111");assertTrue(b1);assertTrue(!b2);}@TestpublicvoidloginSuccess(){Useruser=userService.findUserByUserName("admin");user.setUserId(1);user.setUserName("admin");user.setLastIp("192.168.12.7");user.setLastVisit(newDate());userService.loginSuccess(user);}}

运维报错如下

三月11,201910:14:14下午org.springframework.context.support.AbstractApplicationContextprepareRefresh信息:Refreshingorg.springframework.context.support.GenericApplicationContext@62ee68d8:startupdate[MonMar1122:14:14CST2019];rootofcontexthierarchy三月11,201910:14:14下午org.springframework.beans.factory.support.DefaultListableBeanFactorypreInstantiateSingletons信息:Pre-instantiatingsingletonsinorg.springframework.beans.factory.support.DefaultListableBeanFactory@3e57cd70:definingbeans[org.springframework.context.annotation.internalConfigurationAnnotationProcessor,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org.springframework.context.annotation.internalRequiredAnnotationProcessor,org.springframework.context.annotation.internalCommonAnnotationProcessor,org.springframework.context.annotation.ConfigurationClassPostProcessor$ImportAwareBeanPostProcessor#0];rootoffactoryhierarchy三月11,201910:14:14下午org.springframework.test.context.TestContextManagerprepareTestInstance严重:CaughtexceptionwhileallowingTestExecutionListener[org.springframework.test.context.support.DependencyInjectionTestExecutionListener@768b970c]topreparetestinstance[com.smart.service.UserServiceTest@79698539]org.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'com.smart.service.UserServiceTest':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.smart.service.UserServicecom.smart.service.UserServiceTest.userService;nestedexceptionisorg.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[com.smart.service.UserService]foundfordependency:expectedatleast1beanwhichqualifiesasautowirecandidateforthisdependency.Dependencyannotations:{@org.springframework.beans.factory.annotation.Autowired(required=true)}atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:374)atorg.springframework.test.context.support.DependencyInjectionTestExecutionListener.injectDependencies(DependencyInjectionTestExecutionListener.java:110)atorg.springframework.test.context.support.DependencyInjectionTestExecutionListener.prepareTestInstance(DependencyInjectionTestExecutionListener.java:75)atorg.springframework.test.context.TestContextManager.prepareTestInstance(TestContextManager.java:321)atorg.springframework.test.context.testng.AbstractTestNGSpringContextTests.springTestContextPrepareTestInstance(AbstractTestNGSpringContextTests.java:133)atsun.reflect.NativeMethodAccessorImpl.invoke0(NativeMethod)atsun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)atsun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)atjava.lang.reflect.Method.invoke(Method.java:498)atorg.testng.internal.MethodInvocationHelper.invokeMethod(MethodInvocationHelper.java:80)atorg.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:543)atorg.testng.internal.Invoker.invokeConfigurations(Invoker.java:212)atorg.testng.internal.Invoker.invokeConfigurations(Invoker.java:138)atorg.testng.internal.TestMethodWorker.invokeBeforeClassMethods(TestMethodWorker.java:175)atorg.testng.internal.TestMethodWorker.run(TestMethodWorker.java:107)atorg.testng.TestRunner.privateRun(TestRunner.java:758)atorg.testng.TestRunner.run(TestRunner.java:613)atorg.testng.SuiteRunner.runTest(SuiteRunner.java:334)atorg.testng.SuiteRunner.runSequentially(SuiteRunner.java:329)atorg.testng.SuiteRunner.privateRun(SuiteRunner.java:291)atorg.testng.SuiteRunner.run(SuiteRunner.java:240)atorg.testng.SuiteRunnerWorker.runSuite(SuiteRunnerWorker.java:53)atorg.testng.SuiteRunnerWorker.run(SuiteRunnerWorker.java:87)atorg.testng.TestNG.runSuitesSequentially(TestNG.java:1137)atorg.testng.TestNG.runSuitesLocally(TestNG.java:1062)atorg.testng.TestNG.run(TestNG.java:974)atorg.testng.IDEARemoteTestNG.run(IDEARemoteTestNG.java:73)atorg.testng.RemoteTestNGStarter.main(RemoteTestNGStarter.java:123)Causedby:org.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.smart.service.UserServicecom.smart.service.UserServiceTest.userService;nestedexceptionisorg.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[com.smart.service.UserService]foundfordependency:expectedatleast1beanwhichqualifiesasautowirecandidateforthisdependency.Dependencyannotations:{@org.springframework.beans.factory.annotation.Autowired(required=true)}atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:506)atorg.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:87)atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:284)...29moreCausedby:org.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[com.smart.service.UserService]foundfordependency:expectedatleast1beanwhichqualifiesasautowirecandidateforthisdependency.Dependencyannotations:{@org.springframework.beans.factory.annotation.Autowired(required=true)}atorg.springframework.beans.factory.support.DefaultListableBeanFactory.raiseNoSuchBeanDefinitionException(DefaultListableBeanFactory.java:924)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.doResolveDependency(DefaultListableBeanFactory.java:793)atorg.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:707)atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:478)...31moreorg.springframework.beans.factory.BeanCreationException:Errorcreatingbeanwithname'com.smart.service.UserServiceTest':Injectionofautowireddependenciesfailed;nestedexceptionisorg.springframework.beans.factory.BeanCreationException:Couldnotautowirefield:privatecom.smart.service.UserServicecom.smart.service.UserServiceTest.userService;nestedexceptionisorg.springframework.beans.factory.NoSuchBeanDefinitionException:Nomatchingbeanoftype[com.smart.service.UserService]foundfordependency:expectedatleast1beanwhichqualifiesasautowirecandidateforthisdependency.Dependencyannotations:{@org.springframework.beans.factory.annotation.Autowired(required=true)}atorg.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:287)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)atorg.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.autowireBeanProperties(AbstractAutowireCapableBeanFactory.java:374)atorg.springframework.test.context.support.DependencyInjectionTes

上一篇:没有了
下一篇:没有了
友情链接: 网站地图
Copyright © 2015-2019 http://www.tk-web.com. bb电子糖果派对有限公司 版权所有