代码没有问题,但是启动运行报错
2023-10-25 16:59:38.165 INFO 228964 --- [ main] c.h.h.HailiaowenanApplication : Starting HailiaowenanApplication on ganluhua with PID 228964 (D:\ganluhua\code\java\hailiao-java\target\classes started by 80913 in D:\ganluhua\code\java\hailiao-java)
2023-10-25 16:59:38.166 INFO 228964 --- [ main] c.h.h.HailiaowenanApplication : No active profile set, falling back to default profiles: default
2023-10-25 16:59:38.210 INFO 228964 --- [ main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@3f91b517: startup date [Wed Oct 25 16:59:38 CST 2023]; root of context hierarchy
2023-10-25 16:59:39.015 INFO 228964 --- [ main] .s.d.r.c.RepositoryConfigurationDelegate : Multiple Spring Data modules found, entering strict repository configuration mode!
2023-10-25 16:59:39.207 WARN 228964 --- [ main] o.s.b.f.s.DefaultListableBeanFactory : Bean creation exception on non-lazy FactoryBean type check: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'wxOrderMapper' defined in file [D:\ganluhua\code\java\hailiao-java\target\classes\com\hi\hailiaowenan\wxpay\mapper\WxOrderMapper.class]: Unsatisfied dependency expressed through bean property 'sqlSessionTemplate'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration': Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration]: No default constructor found; nested exception instantiate java.lang.NoSuchMethodException: org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration.<init>()
原因,jdk没有在系统配置中配置正确
配置指引
VScode 运行Java - 简书
按住win+R,输入cmd
输入java,应为如下显示:
输入javac,应为如下显示: