root case
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘studentController’: Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type ‘com.wuhu.service.StudentService’ available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@javax.annotation.Resource(shareable=true, lookup=, name=, description=, authenticationType=CONTAINER, type=class java.lang.Object, mappedName=)}
org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessProperties(CommonAnnotationBeanPostProcessor.java:337)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594)
org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517)
org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean
0
(
A
b
s
t
r
a
c
t
B
e
a
n
F
a
c
t
o
r
y
.
j
a
v
a
:
323
)
o
r
g
.
s
p
r
i
n
g
f
r
a
m
e
w
o
r
k
.
b
e
a
n
s
.
f
a
c
t
o
r
y
.
s
u
p
p
o
r
t
.
D
e
f
a
u
l
t
S
i
n
g
l
e
t
o
n
B
e
a
n
R
e
g
i
s
t
r
y
.
g
e
t
S
i
n
g
l
e
t
o
n
(
D
e
f
a
u
l
t
S
i
n
g
l
e
t
o
n
B
e
a
n
R
e
g
i
s
t
r
y
.
j
a
v
a
:
222
)
o
r
g
.
s
p
r
i
n
g
f
r
a
m
e
w
o
r
k
.
b
e
a
n
s
.
f
a
c
t
o
r
y
.
s
u
p
p
o
r
t
.
A
b
s
t
r
a
c
t
B
e
a
n
F
a
c
t
o
r
y
.
d
o
G
e
t
B
e
a
n
(
A
b
s
t
r
a
c
t
B
e
a
n
F
a
c
t
o
r
y
.
j
a
v
a
:
321
)
o
r
g
.
s
p
r
i
n
g
f
r
a
m
e
w
o
r
k
.
b
e
a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
r
v
l
e
t
.
G
e
n
e
r
i
c
S
e
r
v
l
e
t
.
i
n
i
t
(
G
e
n
e
r
i
c
S
e
r
v
l
e
t
.
j
a
v
a
:
158
)
o
r
g
.
a
p
a
c
h
e
.
c
a
t
a
l
i
n
a
.
v
a
l
v
e
s
.
E
r
r
o
r
R
e
p
o
r
t
V
a
l
v
e
.
i
n
v
o
k
e
(
E
r
r
o
r
R
e
p
o
r
t
V
a
l
v
e
.
j
a
v
a
:
79
)
o
r
g
.
a
p
a
c
h
e
.
c
a
t
a
l
i
n
a
.
v
a
l
v
e
s
.
A
b
s
t
r
a
c
t
A
c
c
e
s
s
L
o
g
V
a
l
v
e
.
i
n
v
o
k
e
(
A
b
s
t
r
a
c
t
A
c
c
e
s
s
L
o
g
V
a
l
v
e
.
j
a
v
a
:
620
)
o
r
g
.
a
p
a
c
h
e
.
c
a
t
a
l
i
n
a
.
c
o
n
n
e
c
t
o
r
.
C
o
y
o
t
e
A
d
a
p
t
e
r
.
s
e
r
v
i
c
e
(
C
o
y
o
t
e
A
d
a
p
t
e
r
.
j
a
v
a
:
502
)
o
r
g
.
a
p
a
c
h
e
.
c
o
y
o
t
e
.
h
t
t
p
11.
A
b
s
t
r
a
c
t
H
t
t
p
11
P
r
o
c
e
s
s
o
r
.
p
r
o
c
e
s
s
(
A
b
s
t
r
a
c
t
H
t
t
p
11
P
r
o
c
e
s
s
o
r
.
j
a
v
a
:
1132
)
o
r
g
.
a
p
a
c
h
e
.
c
o
y
o
t
e
.
A
b
s
t
r
a
c
t
P
r
o
t
o
c
o
l
0(AbstractBeanFactory.java:323) org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:882) org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878) org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550) org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:702) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:668) org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:716) org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:591) org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:530) org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:170) javax.servlet.GenericServlet.init(GenericServlet.java:158) org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620) org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502) org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132) org.apache.coyote.AbstractProtocol
0(AbstractBeanFactory.java:323)org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321)org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202)org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:882)org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:878)org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:550)org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:702)org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:668)org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:716)org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:591)org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:530)org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:170)javax.servlet.GenericServlet.init(GenericServlet.java:158)org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:620)org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:502)org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1132)org.apache.coyote.AbstractProtocolAbstractConnectionHandler.process(AbstractProtocol.java:684)
org.apache.tomcat.util.net.AprEndpoint
S
o
c
k
e
t
P
r
o
c
e
s
s
o
r
.
d
o
R
u
n
(
A
p
r
E
n
d
p
o
i
n
t
.
j
a
v
a
:
2527
)
o
r
g
.
a
p
a
c
h
e
.
t
o
m
c
a
t
.
u
t
i
l
.
n
e
t
.
A
p
r
E
n
d
p
o
i
n
t
SocketProcessor.doRun(AprEndpoint.java:2527) org.apache.tomcat.util.net.AprEndpoint
SocketProcessor.doRun(AprEndpoint.java:2527)org.apache.tomcat.util.net.AprEndpointSocketProcessor.run(AprEndpoint.java:2516)
java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor
W
o
r
k
e
r
.
r
u
n
(
T
h
r
e
a
d
P
o
o
l
E
x
e
c
u
t
o
r
.
j
a
v
a
:
617
)
o
r
g
.
a
p
a
c
h
e
.
t
o
m
c
a
t
.
u
t
i
l
.
t
h
r
e
a
d
s
.
T
a
s
k
T
h
r
e
a
d
Worker.run(ThreadPoolExecutor.java:617) org.apache.tomcat.util.threads.TaskThread
Worker.run(ThreadPoolExecutor.java:617)org.apache.tomcat.util.threads.TaskThreadWrappingRunnable.run(TaskThread.java:61)
java.lang.Thread.run(Thread.java:745)
我的原因
经过我多次调试,最后发现是在web.xml文件中我注册spring监听器时:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:conf/applicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextCleanupListener
</listener-class>
将org.springframework.web.context.ContextCleanupListener改为org.springframework.web.context.ContextLoaderListener就好了(笔误害人啊,弄了老半天)