본문 바로가기
백엔드/Spring

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

by RoJae 2020. 4. 15.

      로재의 개발 일기      

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


mapper가 pom.xml에서 제대로 mapping 되지 않았기 때문에 발생하는 문제입니다.


저는 오랜만에 Import한 프로젝트에서 이러한 문제가 발생했지만

금방 구글링을 통해서 문제를 해결할 수 있었어요.


+ 개발 환경이 달라지면 이런 문제가 생기는 것 같아요.



  원인

mapper.xml

위와 같이 .xml을 resource 폴더가 아닌 인터페이스 부분에 위치한 경우





pom.xml

pom.xml 에서 이를 정상적으로 인식하지 못해

build가 되지 않습니다.



  해결법

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
<resources>
    <resource>
        <!-- src/main/java 위치-->
        <directory>src/main/java</directory>
        <includes>
            <include>**/*.xml</include>
        </includes>
    </resource>
    <resource>
        <!-- src/main/resources 위치-->
        <directory>src/main/resources</directory>
        <includes>
            <include>**/*.xml</include>
            <include>**/*.properties</include>
            <!-- <include>**/*.setting</include> -->
        </includes>
    </resource>
</resources>
cs

src/main/java

- 첫번째 resource를 적용


src/main/resources

- 두번째 resource를 적용


그대로

<build> </build> 안에

추가하면

정상적으로 작동합니다.




마무리

IDE 및 실행환경에 따라 셋팅이 천차만별이다.

IntelliJ에서는 이클립스와는 다르게 위와 같은 절차가 필요했다.



참고글




반응형

댓글