报错信息如下:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No qualifying bean of type 'com.xxx.service.AdminService' available: expected at least 1 bean which qualifies as autowire candidate. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}
说是没有找到service层,是因为:没有在web.xml配置监听器,当应用启动的时候就需要获取到Spring容器,但是并没有获取到 ---> 因为我压根没配置。
也是突然想到,网上的都是说没有配置注解,我无语了...
能帮一个是一个吧...
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:springApplicationContext.xml</param-value>
</context-param>
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>