org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource
項目是用Maven搭建的基於spring boot2.5.1的多模塊項目.啓動就發生了錯誤.
以我學習別人的經驗,計算機只是按照它自己特定的方式執行程式.出錯通常是我們自己哪裏出了錯誤,出錯了不要怕正是我們進步的時候,記錄一下錯誤消息,以避免下次出現同樣的錯,又不知道怎麽辦,只能又在網際網絡上找自己想要的答案,可以先自己試著在錯誤信息裏,從上至下找下大概的問題,也許是哪裏代碼錯了,或者資料路徑錯了,總之自己應該在沒有別人的情況下,自己先試著解決問題.
錯誤的部分信息:
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.5.1)
INFO 18476 --- [ restartedMain] t.g.xxx.xxx.UserApplication : The following profiles are active: config
INFO 18476 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : Devtools property defaults active! Set 'spring.devtools.add-properties' to 'false' to disable
INFO 18476 --- [ restartedMain] .e.DevToolsPropertyDefaultsPostProcessor : For additional web related logging consider setting the 'logging.level.web' property to 'DEBUG'
WARN 18476 --- [ restartedMain] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[xxx.xxx.user.mapper.*]' package. Please check your configuration.
INFO 18476 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http)
INFO 18476 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat]
INFO 18476 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet engine: [Apache Tomcat/9.0.46]
INFO 18476 --- [ restartedMain] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
INFO 18476 --- [ restartedMain] w.s.c.ServletWebServerApplicationContext : Root WebApplicationContext: initialization completed in 1087 ms
INFO 18476 --- [ restartedMain] o.s.b.a.w.s.WelcomePageHandlerMapping : Adding welcome page template: index
WARN 18476 --- [ restartedMain] ConfigServletWebServerApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sqlSessionFactory' defined in class path resource [org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.apache.ibatis.session.SqlSessionFactory]: Factory method 'sqlSessionFactory' threw exception; nested exception is org.springframework.core.NestedIOException: Failed to parse mapping resource: 'file [E:\xxx\target\classes\mappers\ArticleMapper.xml]'; nested exception is org.apache.ibatis.builder.BuilderException: Error parsing Mapper XML. The XML location is 'file [E:\xxx\target\classes\mappers\ArticleMapper.xml]'. Cause