81,092
社区成员
发帖
与我相关
我的任务
分享
@Repository("wxDao")
public class WxDaoImpl implements WxDao {
@Autowired
private JdbcTemplate jt;
@Override
public List<Map<String, Object>> getUserList() {
// TODO Auto-generated method stub
String sql="select * from userTable";
System.out.println("success");
return null;
}
}
2018-03-22 16:21:25.222 WARN 10860 --- [ main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wxController': Unsatisfied dependency expressed through field 'wxService'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'wxService': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wxDao': Unsatisfied dependency expressed through field 'jt'; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'org.springframework.jdbc.core.JdbcTemplate' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
2018-03-22 16:21:25.226 INFO 10860 --- [ main] o.apache.catalina.core.StandardService : Stopping service Tomcat
2018-03-22 16:21:25.239 WARN 10860 --- [ost-startStop-1] o.a.c.loader.WebappClassLoaderBase : The web application [weappservice] appears to have started a thread named [Abandoned connection cleanup thread] but has failed to stop it. This is very likely to create a memory leak. Stack trace of thread:
java.lang.Object.wait(Native Method)
java.lang.ref.ReferenceQueue.remove(ReferenceQueue.java:142)
com.mysql.jdbc.AbandonedConnectionCleanupThread.run(AbandonedConnectionCleanupThread.java:40)
2018-03-22 16:21:25.254 INFO 10860 --- [ main] utoConfigurationReportLoggingInitializer :
Error starting ApplicationContext. To display the auto-configuration report re-run your application with 'debug' enabled.
2018-03-22 16:21:25.398 ERROR 10860 --- [ main] o.s.b.d.LoggingFailureAnalysisReporter :
***************************
APPLICATION FAILED TO START
***************************
Description:
Field jt in com.weapp.dao.impl.WxDaoImpl required a bean of type 'org.springframework.jdbc.core.JdbcTemplate' that could not be found.
- Bean method 'jdbcTemplate' not loaded because @ConditionalOnSingleCandidate (types: javax.sql.DataSource; SearchStrategy: all) did not find any beans
Action:
Consider revisiting the conditions above or defining a bean of type 'org.springframework.jdbc.core.JdbcTemplate' in your configuration.
###### dbsource######
spring.datasource.url=jdbc:mysql://localhost:3306/wxapp
spring.datasource.username=root
spring.datasource.password=sql12345
spring.datasource.driver-class-name=com.mysql.jdbc.Driver