帅明 2015-08-26 08:50 采纳率: 0%
浏览 707

maven构建springmvc+ibatis,sqlmap文件不能访问试题Bean的问题

图片说明
如图片所示,使用resources分结构之后就出现了这个问题,求各路大神指点~,一下是我得配置文件
web.xml

 <context-param> 
        <param-name>contextConfigLocation</param-name>  
        <param-value>classpath:*/**/applicationContext.xml, */**/applicationContext-*-bean.xml</param-value>  
    </context-param>  

    <listener>  
        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class> 
    </listener>  

    <servlet>  
        <servlet-name>dispatcher</servlet-name>  
        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
        <init-param>
            <param-name>contextConfigLocation</param-name>
            <param-value>classpath:*/**/*-mvc.xml</param-value>
        </init-param>  
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>  
    </servlet>

spring文件

 <bean name="sqlDao" scope="prototype" class="com.icdc.sqldao.SqlDaoImpl" />
    <bean name="loginService" scope="prototype" class="com.icdc.service.impl.LoginServiceImpl" />

mvc文件

 <!-- 对包中的所有类进行扫描,以完成Bean创建和自动依赖注入的功能 需要更改 -->
    <context:component-scan base-package="com.icdc" >
        <context:include-filter type="annotation" expression="org.springframework.stereotype.Controller"/>
        <context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service" />    
    </context:component-scan>

    <mvc:annotation-driven />

    <!-- 启动Spring MVC的注解功能,完成请求和注解POJO的映射 -->
    <bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter" />

    <!-- 防止jsp等静态资源被拦截 -->
    <mvc:default-servlet-handler />

我只是把主要的配置文件复制了出来,其他一切正常。如果将sqlmap的配置文件放在src/main/java路径下启动不报错,也可以正常访问数据库并查询出数据,放在src/main/resources下就报找不到这个bean的错误。

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 对于相关问题的求解与代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 信号傅里叶变换在matlab上遇到的小问题请求帮助
    • ¥15 保护模式-系统加载-段寄存器
    • ¥15 电脑桌面设定一个区域禁止鼠标操作
    • ¥15 求NPF226060磁芯的详细资料
    • ¥15 使用R语言marginaleffects包进行边际效应图绘制
    • ¥20 usb设备兼容性问题
    • ¥15 错误(10048): “调用exui内部功能”库命令的参数“参数4”不能接受空数据。怎么解决啊
    • ¥15 安装svn网络有问题怎么办