springboot项目,在idea中可以正常启动。打包后在windows环境下启动报错:

    Caused by: java.lang.ClassNotFoundException: org.springframework.jdbc.core.ConnectionCallback at java.net.URLClassLoader.findClass(Unknown Source) ~[na:1.8.0_40] at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_40] at org.springframework.boot.loader.LaunchedURLClassLoader.loadClass(LaunchedURLClassLoader.java:151) ~[demo-1.0-SNAPSHOT.jar:1.0-SNAPSHOT] at java.lang.ClassLoader.loadClass(Unknown Source) ~[na:1.8.0_40] … 100 common frames omitted

    查看打出的jar包,发现少了spring-jdbc的依赖。检查pom.xml后发现是少引用了以下代码:


    org.springframework.boot
    spring-boot-starter-jdbc

    重新打包后正常启动。