跟着极客学院上的教程搭建 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:
以上就是配置的所有了,还是一直卡在最开始说的那里,求大神帮忙解决,先谢谢了!!!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号
右击
config目录下的applicationContext.xmlbuild path -> add to build path