java - Spring配置问题
阿神
阿神 2017-04-17 17:24:18
[Java讨论组]

跟着极客学院上的教程搭建 Spring+SpringMVC+Hibernate 的环境的时候用Junit进行环境的测试。
然后卡在这一步了。

2016-3-16 19:29:45 org.springframework.context.support.AbstractApplicationContext prepareRefresh
信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@a94884d: startup date [Wed Mar 16 19:29:45 CST 2016]; root of context hierarchy
2016-3-16 19:29:45 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from class path resource [calsspath:applicationContext.xml]

Junit代码:

package com.whr.test;

import static org.junit.Assert.*;

import org.junit.Test;
import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

public class TestSSH {

    @Test
    public void test() {
        fail("Not yet implemented");
    }
    
    private ApplicationContext ctx = null;
    
    @Test
    public void testDataSource()
    {
        ctx = new ClassPathXmlApplicationContext("applicationContext.xml");
        System.out.println(ctx);
    }
}

目录结构:

applicationContext.xml内容:




    
    
        
        
    
    
    
    
    

    
    
        
        
        
        
    

    
    
        
        
        
        
            
        
        

        
        
            
                
                org.hibernate.dialect.MySQLInnoDBDialect
                true
                true
                update
            
        
    

    
    
      
    

web.xml:



      
  
    index.jsp
  
  
  
    
        contextConfigLocation
        classpath:applicationContext.xml
    
    
        org.springframework.web.context.ContextLoaderListener
    


    
    
        dispatcherServlet
        org.springframework.web.servlet.DispatcherServlet
        
            contextConfigLocation
            classpath:springmvc.xml
        
        1
    
    
        dispatcherServlet
        /*
    
    
    
    
        characterEncodingFilter
        org.springframework.web.filter.CharacterEncodingFilter
        
            encoding
            UTF-8
        
    
    
        characterEncodingFilter
        /*
    

springmvc.xml:





    
    
        
        
    
    
    
        
        
    

    
    
    
    

以上就是配置的所有了,还是一直卡在最开始说的那里,求大神帮忙解决,先谢谢了!!!

阿神
阿神

闭关修行中......

全部回复(1)
阿神

右击config目录下的applicationContext.xml
build path -> add to build path

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 举报中心 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号