[에러] Invalid bound statement (not found)

602·2021년 10월 29일
0

org.apache.ibatis.binding.BindingException: Invalid bound statement (not found)

원인

  1. mapper interface의 method명과 Mapper.xml의 id가 일치하지 않을 경우
  2. Mapper.xml의 경로가 잘못된 경우

해결

Mapper.xml 경로

root-context.xml 에서 classpath 를 지금까지 '수정 전'과 같이 설정해서 사용하고 있었는데 오류가 났고, '수정 후'로 변경 후 에러가 해결됨.

수정 전

	<bean id="sqlSessionFactory"
		class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource"></property>
		<property name="configLocation" value="classpath:/mybatis-config.xml"></property>
		<property name="mapperLocations" value="classpath:mappers/**/*.xml"></property>
	</bean>

수정 후

	<bean id="sqlSessionFactory"
		class="org.mybatis.spring.SqlSessionFactoryBean">
		<property name="dataSource" ref="dataSource"></property>
		<property name="configLocation" value="classpath:/mybatis-config.xml"></property>
		<property name="mapperLocations" value="classpath:mappers/*.xml"></property>
	</bean>

0개의 댓글