spring-boot配置Mybatis的时候总是出现这样的情况。
控制台显示错误:
org.apache.ibatis.binding.BindingException: Invalid bound statement (not found): com.example.demo.dao.mapper.clDao.queryAll
at org.apache.ibatis.binding.MapperMethod
S
q
l
C
o
m
m
a
n
d
.
<
i
n
i
t
>
(
M
a
p
p
e
r
M
e
t
h
o
d
.
j
a
v
a
:
235
)
[
m
y
b
a
t
i
s
−
3.5.6.
j
a
r
:
3.5.6
]
a
t
o
r
g
.
a
p
a
c
h
e
.
i
b
a
t
i
s
.
b
i
n
d
i
n
g
.
M
a
p
p
e
r
M
e
t
h
o
d
.
<
i
n
i
t
>
(
M
a
p
p
e
r
M
e
t
h
o
d
.
j
a
v
a
:
53
)
[
m
y
b
a
t
i
s
−
3.5.6.
j
a
r
:
3.5.6
]
a
t
o
r
g
.
a
p
a
c
h
e
.
i
b
a
t
i
s
.
b
i
n
d
i
n
g
.
M
a
p
p
e
r
P
r
o
x
y
.
l
a
m
b
d
a
SqlCommand.<init>(MapperMethod.java:235) ~[mybatis-3.5.6.jar:3.5.6] at org.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:53) ~[mybatis-3.5.6.jar:3.5.6] at org.apache.ibatis.binding.MapperProxy.lambda
SqlCommand.<init>(MapperMethod.java:235) [mybatis−3.5.6.jar:3.5.6]atorg.apache.ibatis.binding.MapperMethod.<init>(MapperMethod.java:53) [mybatis−3.5.6.jar:3.5.6]atorg.apache.ibatis.binding.MapperProxy.lambdacachedInvoker
0
(
M
a
p
p
e
r
P
r
o
x
y
.
j
a
v
a
:
115
)
[
m
y
b
a
t
i
s
−
3.5.6.
j
a
r
:
3.5.6
]
a
t
j
a
v
a
.
u
t
i
l
.
c
o
n
c
u
r
r
e
n
t
.
C
o
n
c
u
r
r
e
n
t
H
a
s
h
M
a
p
.
c
o
m
p
u
t
e
I
f
A
b
s
e
n
t
(
C
o
n
c
u
r
r
e
n
t
H
a
s
h
M
a
p
.
j
a
v
a
:
1660
)
[
n
a
:
1.8.
0
1
71
]
a
t
o
r
g
.
a
p
a
c
h
e
.
i
b
a
t
i
s
.
b
i
n
d
i
n
g
.
M
a
p
p
e
r
P
r
o
x
y
.
c
a
c
h
e
d
I
n
v
o
k
e
r
(
M
a
p
p
e
r
P
r
o
x
y
.
j
a
v
a
:
102
)
[
m
y
b
a
t
i
s
−
3.5.6.
j
a
r
:
3.5.6
]
a
t
o
r
g
.
a
p
a
c
h
e
.
i
b
a
t
i
s
.
b
i
n
d
i
n
g
.
M
a
p
p
e
r
P
r
o
x
y
.
i
n
v
o
k
e
(
M
a
p
p
e
r
P
r
o
x
y
.
j
a
v
a
:
85
)
[
m
y
b
a
t
i
s
−
3.5.6.
j
a
r
:
3.5.6
]
a
t
c
o
m
.
s
u
n
.
p
r
o
x
y
.
0(MapperProxy.java:115) ~[mybatis-3.5.6.jar:3.5.6] at java.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) ~[na:1.8.0_171] at org.apache.ibatis.binding.MapperProxy.cachedInvoker(MapperProxy.java:102) ~[mybatis-3.5.6.jar:3.5.6] at org.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85) ~[mybatis-3.5.6.jar:3.5.6] at com.sun.proxy.
0(MapperProxy.java:115) [mybatis−3.5.6.jar:3.5.6]atjava.util.concurrent.ConcurrentHashMap.computeIfAbsent(ConcurrentHashMap.java:1660) [na:1.8.0171]atorg.apache.ibatis.binding.MapperProxy.cachedInvoker(MapperProxy.java:102) [mybatis−3.5.6.jar:3.5.6]atorg.apache.ibatis.binding.MapperProxy.invoke(MapperProxy.java:85) [mybatis−3.5.6.jar:3.5.6]atcom.sun.proxy.Proxy73.queryAll(Unknown Source) ~[na:na]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_171]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[na:1.8.0_171]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[na:1.8.0_171]
at java.lang.reflect.Method.invoke(Method.java:498) ~[na:1.8.0_171]
at org.springframework.aop.support.AopUtils.invokeJoinpointUsingReflection(AopUtils.java:344) ~[spring-aop-5.3.4.jar:5.3.4]
at org.springframework.aop.framework.ReflectiveMethodInvocation.invokeJoinpoint(ReflectiveMethodInvocation.java:198) ~[spring-aop-5.3.4.jar:5.3.4]
at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:163) ~[spring-aop-5.3.4.jar:5.3.4]
解决方法:
在application.properties里加上
mybatis.mapperLocations=classpath:com/example/demo/dao/sqlmap/*.xml
或者是这一段路径写错了修改一下。之后便可以查询出来。