Springmvc + Mybatis報錯解決
阿新 • • 發佈:2020-12-30
技術標籤:java後端
問題一:Failed properties: Property 'systemPropertiesModeName' threw exception;
錯誤原因:
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath:*.properties</value>
</property>
</bean>
和
<!-- 讀取配置檔案 -->
<context:property-placeholder location="classpath:db.properties" />
Springmvc + Mybatis兩種方式最好不要同時配置,特別是不能再spring-mvc配置檔案中使用了前者,又在mybatis配置檔案中使用後者
問題二:Caused by: java.lang.NoClassDefFoundError: org/aspectj/lang/annotation/Aspect
解決:缺少aspectjweaver-XXX.jar包,匯入即可
或者pom.xml檔案中新增依賴:
<dependency>
<groupId> org.aspectj</groupId >
<artifactId> aspectjweaver</artifactId >
<version> 1.8.9</version
</dependency>
問題三:Cannot find class [com.baomidou.mybatisplus.spring.MybatisSqlSessionFactoryBean] for bean with name 'sqlSessionFactory' defined in class path resource [spring-mybatis.xml];