部分错误信息:最主要的是Property 'dataSource' is required
D:jdkjdkbinjava.exe -ea -Didea.test.cyclic.buffer.size=1048576 "-javaagent:D:IntelliJ IDEA 2019.1.3libidea_rt.jar=4564:D:IntelliJ IDEA 2019.1.3bin" -Dfile.encoding=UTF-8 -classpath "D:IntelliJ IDEA 2019.1.3libidea_rt.jar;D:IntelliJ IDEA 2019.1.3pluginsjunitlibjunit-rt.jar;D:IntelliJ IDEA 2019.1.3pluginsjunitlibjunit5-rt.jar;D:jdkjdkjrelibcharsets.jar;D:jdkjdkjrelibdeploy.jar;D:jdkjdkjrelibextaccess-bridge-32.jar;D:jdkjdkjrelibextcldrdata.jar;D:jdkjdkjrelibextdnsns.jar;D:jdkjdkjrelibextjaccess.jar;D:jdkjdkjrelibextjfxrt.jar;D:jdkjdkjrelibextlocaledata.jar;D:jdkjdkjrelibextnashorn.jar;D:jdkjdkjrelibextsunec.jar;D:jdkjdkjrelibextsunjce_provider.jar;D:jdkjdkjrelibextsunmscapi.jar;D:jdkjdkjrelibextsunpkcs11.jar;D:jdkjdkjrelibextzipfs.jar;D:jdkjdkjrelibjavaws.jar;D:jdkjdkjrelibjce.jar;D:jdkjdkjrelibjfr.jar;D:jdkjdkjrelibjfxswt.jar;D:jdkjdkjrelibjsse.jar;D:jdkjdkjrelibmanagement-agent.jar;D:jdkjdkjrelibplugin.jar;D:jdkjdkjrelibresources.jar;D:jdkjdkjrelibrt.jar;D:IDEAspring5_demo4outproductionspring5_demo4;D:IDEAspring5_demo4libcommons-logging-1.1.1.jar;D:IDEAspring5_demo4libspring-beans-5.2.6.RELEASE.jar;D:IDEAspring5_demo4libspring-context-5.2.6.RELEASE.jar;D:IDEAspring5_demo4libspring-core-5.2.6.RELEASE.jar;D:IDEAspring5_demo4libspring-expression-5.2.6.RELEASE.jar;C:Users34709.m2repositoryjunitjunit4.12junit-4.12.jar;C:Users34709.m2repositoryorghamcresthamcrest-core1.3hamcrest-core-1.3.jar;D:IDEAspring5_demo4libdruid-1.1.9.jar;D:IDEAspring5_demo4libspring-aop-5.2.6.RELEASE.jar;D:IDEAspring5_demo4libcom.springsource.net.sf.cglib-2.2.0.jar;D:IDEAspring5_demo4libcom.springsource.org.aopalliance-1.0.0.jar;D:IDEAspring5_demo4libcom.springsource.org.aspectj.weaver-1.6.8.RELEASE.jar;D:IDEAspring5_demo4libspring-aspects-5.2.6.RELEASE.jar;D:IDEAspring5_demo4libmysql-connector-java-8.0.23.jar;D:IDEAspring5_demo4libspring-jdbc-5.2.6.RELEASE.jar;D:IDEAspring5_demo4libspring-orm-5.2.6.RELEASE.jar;D:IDEAspring5_demo4libspring-tx-5.2.6.RELEASE.jar" com.intellij.rt.execution.junit.JUnitStarter -ideVersion5 -junit4 com.atguigu.spring5.test.TestBook,testJdbcTemplate 十月 22, 2021 10:39:21 上午 org.springframework.context.support.AbstractApplicationContext refresh 警告: Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bookDaoImpl': Unsatisfied dependency expressed through field 'jdbcTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcTemplate' defined in class path resource [bean3.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'dataSource' is required org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'bookDaoImpl': Unsatisfied dependency expressed through field 'jdbcTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jdbcTemplate' defined in class path resource [bean3.xml]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: Property 'dataSource' is required Caused by: java.lang.IllegalArgumentException: Property 'dataSource' is required at org.springframework.jdbc.support.JdbcAccessor.afterPropertiesSet(JdbcAccessor.java:160) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1855) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1792) ... 47 more Process finished with exit code -1
这是因为我们配置dataSource后没有连接需要添加如代码



