ssm测试类加载spring配置文件遇到的问题?

在ssm整合时

####配置文件 ApplicationContext.xml


<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
 
    <import resource="springmvc.xml"/>
    <import resource="springDao.xml"/>
    <import resource="spring-service.xml"/>
beans>

配置文件springDao.xml


<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xsi:schemaLocation="http://www.springframework.org/schema/beans
       http://www.springframework.org/schema/beans/spring-beans.xsd
       http://www.springframework.org/schema/context
       https://www.springframework.org/schema/context/spring-context.xsd">
 
 
 
    
    <context:property-placeholder location="classpath:jdbc.properties"/>
 
    
    <bean id="myDataSource" class="com.alibaba.druid.pool.DruidDataSource" init-method="init" destroy-method="close">
        <property name="driverClassName" value="${jdbc.driver}"/>
        <property name="url" value="${jdbc.url}"/>
        <property name="username" value="${jdbc.username}"/>
        <property name="password" value="${jdbc.password}"/>
    bean>
 
 
    
    <bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
        
        <property name="dataSource" ref="myDataSource"/>
        
        <property name="configLocation" value="classpath:mybatis-config.xml"/>
        <property name="typeAliasesPackage" value="com.pojo">property>
    bean>
 
 
    <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer">
        <property name="sqlSessionFactoryBeanName" value="sqlSessionFactory">property>
        
        <property name="basePackage" value="com.dao"/>
    bean>
 
beans>

配置文件springmvc.xml


<beans xmlns="http://www.springframework.org/schema/beans"
       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
       xmlns:context="http://www.springframework.org/schema/context"
       xmlns:mvc="http://www.springframework.org/schema/mvc"
       xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd http://www.springframework.org/schema/mvc https://www.springframework.org/schema/mvc/spring-mvc.xsd">
 
      <context:component-scan base-package="com.controller"/>
 
      
      <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
            <property name="prefix" value="/WEB-INF/jsp/" />
            <property name="suffix" value=".jsp" />
     
      bean>
 
 
      
      <mvc:annotation-driven />
 
      <mvc:default-servlet-handler/>

测试类测试DAO

 @Test
    public void test1(){
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("springDao.xml");
        StudentDao studentDao = (StudentDao)applicationContext.getBean("studentDao");
        Student student = studentDao.selectBySno("454201");
        System.out.println(student);
    }
 @Test
    public void test1(){
        ApplicationContext applicationContext = new ClassPathXmlApplicationContext("ApplicationContext.xml");
        StudentDao studentDao = (StudentDao)applicationContext.getBean("studentDao");
        Student student = studentDao.selectBySno("454201");
        System.out.println(student);
    }

通一个方法 spring的配置文件 配置springDao就可以正常连接到mysql数据库,但是换成ApplicationContext就报错了

##org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.web.servlet.view.InternalResourceViewResolver#0': Lookup method resolution failed; nested exception is java.lang.IllegalStateException: Failed to introspect Class [org.springframework.web.context.support.WebApplicationObjectSupport] from ClassLoader [sun.misc.Launcher$AppClassLoader@18b4aac2]

web.xml

  <servlet>
    <servlet-name>DispatcherServletservlet-name>
    <servlet-class>org.springframework.web.servlet.DispatcherServletservlet-class>
    <init-param>
      <param-name>contextConfigLocationparam-name>
      <param-value>classpath:ApplicationContext.xmlparam-value>
    init-param>
    
    <load-on-startup>1load-on-startup>
  servlet>
  <servlet-mapping>
    <servlet-name>DispatcherServletservlet-name>
    <url-pattern>/url-pattern>
  servlet-mapping>

###在web.xml文件中配置的是ApplicationContext

在用启动tomcat启动项目时,是可以正常访问数据库的

都是配置ApplicationContext 为哈在测试类中不行啊?原因是什么呀?

在springmvc.xml中:
<context:component-scan base-package="com.controller"/>
你确定这行这样写是对的?
应该改为以下这个吧?
<context:component-scan base-package="com.controller.*"/>