`
greemranqq
  • 浏览: 975760 次
  • 性别: Icon_minigender_1
  • 来自: 重庆
社区版块
存档分类
最新评论
阅读更多

需要的jar :

 

spring 需要的jar 12

spring-webmvc-3.2.2.RELEASE.jar

spring-web-3.2.2.RELEASE.jar

spring-tx-3.2.2.RELEASE.jar

spring-test-3.2.2.RELEASE.jar

spring-orm-3.2.2.RELEASE.jar

spring-jdbc-3.2.2.RELEASE.jar

spring-expression-3.2.2.RELEASE.jar

spring-core-3.2.2.RELEASE.jar

spring-context-3.2.2.RELEASE.jar

spring-beans-3.2.2.RELEASE.jar

spring-aspects-3.2.2.RELEASE.jar

spring-aop-3.2.2.RELEASE.jar

jar作用:http://www.linuxidc.com/Linux/2012-12/76682p3.htm

 

spring-依赖的jar 3

commons-logging-1.0.4.jar

aopalliance-1.0.jar

aspectjweaver.jar

log4j-1.2.16.jar

 

测试需要 1

com.springsource.org.junit-4.7.0.jar

 

 

 

hibernate:required 里面 8

hibernate-core-4.2.1.Final.jar

hibernate-commons-annotations-4.0.1.Final.jar

 

javassist-3.15.0-GA.jar

jboss-logging-3.1.0.GA.jar

jboss-transaction-api_1.1_spec-1.0.1.Final.jar

antlr-2.7.7.jar

dom4j-1.6.1.jar

hibernate-jpa-2.0-api-1.0.1.Final.jar

 

所有jar 的作用参考:http://www.linuxidc.com/Linux/2012-12/76682p2.htm

 

hibernate 缓存需要:4

ehcache-core-2.4.3.jar

slf4j-api-1.6.1.jar

slf4j-log4j12-1.6.1.jar

hibernate-ehcache-4.1.0.Final.jar

 

 

数据库: 1个

mysql-connector-java-5.1.10.jar

 

关于连接池,和其他页面内容,后续再用,先搭个环境:

 

 

建立一个和 src同级的文件resources.将一些配置文件放进去

system_db.properties:数据库相关配置:

 

connection.driver_class=com.mysql.jdbc.Driver
connection.url=jdbc:mysql://localhost:3306/test?useUnicode=true&characterEncoding=UTF-8
connection.username=root
connection.password=root


#这里是用的开涛老师的参数,先预留的,暂时不理解就没用
hibernate.dialect=org.hibernate.dialect.MySQLInnoDBDialect
hibernate.hbm2ddl.auto=none
hibernate.show_sql=false
hibernate.format_sql=true
hibernate.query.substitutions=true 1, false 0
hibernate.default_batch_fetch_size=16
hibernate.max_fetch_depth=2
hibernate.bytecode.use_reflection_optimizer=true
hibernate.cache.use_second_level_cache=true
hibernate.cache.use_query_cache=true
hibernate.cache.region.factory_class=org.hibernate.cache.EhCacheRegionFactory
net.sf.ehcache.configurationResourceName=/ehcache_hibernate.xml
hibernate.cache.use_structured_entries=true
hibernate.generate_statistics=true

 

 

spring-system-config.xml :核心配置文件

 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
       ">
       
       
       
    <!--  启动注解扫描 -->   
    <context:component-scan base-package="com"/> 
       
	<!-- 加载资源文件 -->
	<context:property-placeholder location="classpath:system_db.properties"/>
	<!--  这是原始的方式加载
	<bean id=""
		class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
		<property name="location" value="classpath:system_db.properties" />
	</bean>
	 -->
	<!-- 数据库映射 -->
	<bean id="dataSource"
		class="org.springframework.jdbc.datasource.DriverManagerDataSource">
		<property name="driverClassName" value="${connection.driver_class}"/>
		<property name="url" value="${connection.url}"/>
		<property name="username" value="${connection.username}"/>
		<property name="password" value="${connection.password}"/>
	</bean>
	
	<!-- hibernate 需要的信息 -->
	<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean" >
		<property name="dataSource" ref="dataSource"/>
		<!-- 扫描映射文件,实体类 -->
		<property name="packagesToScan">
			<list>
			    <!-- 这里,是否可以匹配所有com开头,entity 结尾 下所有的实体!? -->
				<value>com..entity</value>
			</list>
		</property>
		<property name="hibernateProperties">
			<props>
				 <prop key="hibernate.dialect">${hibernate.dialect}</prop>
                <prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
                <prop key="hibernate.format_sql">true</prop>
                
                <!-- 其他相关信息
                <prop key="hibernate.query.substitutions">${hibernate.query.substitutions}</prop>
                <prop key="hibernate.default_batch_fetch_size">${hibernate.default_batch_fetch_size}</prop>
                <prop key="hibernate.max_fetch_depth">${hibernate.max_fetch_depth}</prop>
                <prop key="hibernate.generate_statistics">${hibernate.generate_statistics}</prop>
                <prop key="hibernate.bytecode.use_reflection_optimizer">${hibernate.bytecode.use_reflection_optimizer}</prop>
				
                <prop key="hibernate.cache.use_second_level_cache">${hibernate.cache.use_second_level_cache}</prop>
                <prop key="hibernate.cache.use_query_cache">${hibernate.cache.use_query_cache}</prop>
                <prop key="hibernate.cache.region.factory_class">${hibernate.cache.region.factory_class}</prop>
               
                <prop key="hibernate.cache.use_structured_entries">${hibernate.cache.use_structured_entries}</prop>
				 -->
				 <!-- 
                <prop key="net.sf.ehcache.configurationResourceName">${net.sf.ehcache.configurationResourceName}</prop>
                 -->
                
			</props>
		</property>
	</bean>
	
	<aop:aspectj-autoproxy expose-proxy="true"/>
	<!-- 事务管理器,这里可以设置多个 -->
	<tx:annotation-driven transaction-manager="H4TxManager"/>

	<!-- 给事务注入sessionFactory属性 -->
	<bean id="H4TxManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
		<property name="sessionFactory" ref="sessionFactory" />
	</bean>
    
    <!-- 事务属性配置 -->
	<tx:advice id="txAdvice" transaction-manager="H4TxManager">
		<tx:attributes>
		    <!-- 方法对应的传播属性 -->
			<tx:method name="save*" propagation="REQUIRED" />
            <tx:method name="add*" propagation="REQUIRED" />
            <tx:method name="create*" propagation="REQUIRED" />
            <tx:method name="insert*" propagation="REQUIRED" />
            <tx:method name="update*" propagation="REQUIRED" />
            <tx:method name="merge*" propagation="REQUIRED" />
            <tx:method name="del*" propagation="REQUIRED" />
            <tx:method name="remove*" propagation="REQUIRED" />
            <tx:method name="put*" propagation="REQUIRED" />
            <tx:method name="use*" propagation="REQUIRED"/>
            <!--  这里用了开涛 老师的 -->
            <tx:method name="get*" propagation="REQUIRED" read-only="true" />
            <tx:method name="count*" propagation="REQUIRED" read-only="true" />
            <tx:method name="find*" propagation="REQUIRED" read-only="true" />
            <tx:method name="list*" propagation="REQUIRED" read-only="true" />
            <tx:method name="*" read-only="true" />
		</tx:attributes>
	</tx:advice>
	<!-- 事务控制位置,一般在业务层service -->
	<aop:config>
		<aop:pointcut id="txPointcut" expression="execution(* com..service..*.*(..))" />
		<aop:advisor advice-ref="txAdvice" pointcut-ref="txPointcut"/>
	</aop:config>
</beans>

 

 

spring-bean-config.xml :一些需要扩展的bean:

 

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:aop="http://www.springframework.org/schema/aop"
	xmlns:tx="http://www.springframework.org/schema/tx" xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="
       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
       http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.1.xsd
       http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.1.xsd
       http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.1.xsd
       ">
	<!-- 关于返回页面的 -->
    <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
    <property name="prefix" value="/" />
    <property name="suffix" value=".jsp" />
    </bean>
  
</beans>

 

 

 

web.xml 配置:

 

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
  <display-name>springmvc_hibernate</display-name>
  
  <!-- spring 配置 -->
  <servlet>
    <servlet-name>spring</servlet-name>
  	<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  	<init-param>
  		<param-name>contextConfigLocation</param-name>
  		<param-value>classpath:spring-*-config.xml</param-value>
  	</init-param>
  	<load-on-startup>1</load-on-startup>
  </servlet>
  
  <servlet-mapping>
  	<servlet-name>spring</servlet-name>
  	<url-pattern>/</url-pattern>
  </servlet-mapping>
  
  
  <welcome-file-list>
    <welcome-file>index.html</welcome-file>
  </welcome-file-list>
</web-app>

 

 

 

下面是创建的包,全部以com.(action,service,dao,common,test) 命名

 

实体bean:com.entity.User

 

package com.entity;


import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

@Entity
@Table(name = "t_user")  
public class User {
    // 这里在test 库,建立表t_user,字段都很简单,方便测试
    // 主键自动增长
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private int id;
    private String username;
    private String password;
    // 省略set/get
}

 

 

com.conmmon.BaseDao

 

public class BaseDao {
	@Autowired
	private SessionFactory sessionFactory;
	
	public Session getCurrentSession(){
		return sessionFactory.getCurrentSession();
	}
}

 

 

com.dao.IUserDao  和 UserDaoImpl

 

public interface IUserDao {
	/**
	 * 查看条数
	 * @return
	 */
	public int lookUser();
	
	/**
	 * 删除表数据
	 * @return
	 */
	public int deleteUser(int id);
	
	/**
	 * 添加数据
	 * @param user
	 */
	public void saveUser(User user);
}

 

 

 

package com.dao;

import java.util.List;

import org.hibernate.Query;
import org.springframework.stereotype.Repository;

import com.common.BaseDao;
import com.entity.User;

@Repository
public class UserDaoImpl  extends BaseDao implements IUserDao{
	

	/**
	 * 查询个数
	 */
	public int lookUser(){
		//Query query = getCurrentSession().createSQLQuery("SELECT COUNT(*) FROM t_user");
		Query query = getCurrentSession().createQuery("FROM User");
		List<?> l = query.list();
		return l.size();
	}
	
	/**
	 * 删除表数据
	 * @return
	 */
	public int deleteUser(int id){
		Query query = getCurrentSession().createSQLQuery("DELETE  FROM t_user where id = "+id);
		return query.executeUpdate();
	}
	
	/**
	 * 添加数据
	 * @param user
	 */
	public void saveUser(User user){
		getCurrentSession().save(user);
	}
}

 

 

com.service.IUserService 和UserServiceImpl

 

package com.service;

import com.entity.User;

public interface IUserService {
	public int lookUser();
	public int deleteUser(int id);
	public void saveUser(User user);
	
}

 

 

 

package com.service;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.dao.IUserDao;
import com.entity.User;

@Service
public class UserServiceImpl implements IUserService {
	
	@Autowired
	private IUserDao userdao;

	public int lookUser() {
		return userdao.lookUser();
	}
	/**
	 * 删除表数据
	 * @return
	 */
	public int deleteUser(int id){
		return userdao.deleteUser(id);
	}
	/**
	 * 添加数据
	 * @param user
	 */
	public void saveUser(User user){
		userdao.saveUser(user);
	}
}

 

 

com.action.UserAction

 

package com.action;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.entity.User;
import com.service.IUserService;

@Controller
public class UserAction {
	
	@Autowired
	private IUserService userService;
	
	@RequestMapping("/")
	public String getUser(){
		// 返回查询的数量
		System.out.println("old:"+userService.lookUser());
		// 保存一个新的对象
		userService.saveUser(new User());
		System.out.println("new:"+userService.lookUser());
		return "index";
	}
}

 

 

默认返回根目录下的index.jsp 

 

<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Welcome</title>
</head>
<body>
	Hello World!
</body>
</html>

 

 

也可以自己测试:

 

package com.test;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
import org.springframework.test.context.transaction.TransactionConfiguration;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.Assert;

import static junit.framework.Assert.assertEquals;

import com.entity.User;
import com.service.IUserService;


@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:spring-system-config.xml"})
@Transactional
@TransactionConfiguration(transactionManager="H4TxManager",defaultRollback=false)
public class AppTest {

  @Autowired
   private IUserService userService;
    
    @Test
    public void testService() {  
        Assert.notNull(userService);  
    }  
    
    @Test
    public void addUser(){
    	int num = userService.lookUser();
    	userService.saveUser(newUser());
    	assertEquals(userService.lookUser(), num+1);
    	
    }
    
    
    public User newUser(){
    	User u = new User();
    	u.setUsername("test");
    	u.setPassword("pwd");
    	return u;
    }
    
}

 

 

例子很简单,方便像我这类新手学习。可以自己进行慢慢扩展!

 

 

4
6
分享到:
评论
6 楼 greemranqq 2015-07-23  
满城风雨近重阳 写道
你好,我按照你的配置,没有可用的sessionFactory注入啊

你用模板 也行,sessionFactory 仅仅为了获取sesson 的,不知道现在版本 有变化没,不用这框架了把,换个 呵呵
5 楼 满城风雨近重阳 2015-07-20  
你好,我按照你的配置,没有可用的sessionFactory注入啊
4 楼 仗剑者 2014-04-11  
必须来评论一下..帮大忙了
3 楼 yydriver 2013-09-02  
yydriver 写道
楼主,我是初学者,看了的实例,非常感谢如此详细的配置以及讲解
不过,我按照你的讲解配置以后,报错了。
在userAction中,userService不能注入。。。能帮忙分析一下么?那里错了
严重: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userAction': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.service.IUserService com.action.userAction.userService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.dao.IUserDao com.service.UserServiceImpl.userdao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDaoImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.conmmon.BaseDao.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\Develop\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\sopsoft2\WEB-INF\classes\spring-config.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in file [D:\Develop\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\sopsoft2\WEB-INF\classes\spring-config.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcesso


从上诉错误中,你先仔细 看下错误原因,从上到下 找到最后 发现引起的原因是:
Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in file

Could not load JDBC driver class [com.mysql.jdbc.Driver]

也就是 数据源这里出错,你仔细在看看 配置 ,或者看看jar 等原因


非常感谢,问题解决
2 楼 greemranqq 2013-08-08  
楼主,我是初学者,看了的实例,非常感谢如此详细的配置以及讲解
不过,我按照你的讲解配置以后,报错了。
在userAction中,userService不能注入。。。能帮忙分析一下么?那里错了
严重: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userAction': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.service.IUserService com.action.userAction.userService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.dao.IUserDao com.service.UserServiceImpl.userdao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDaoImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.conmmon.BaseDao.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\Develop\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\sopsoft2\WEB-INF\classes\spring-config.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in file [D:\Develop\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\sopsoft2\WEB-INF\classes\spring-config.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcesso


从上诉错误中,你先仔细 看下错误原因,从上到下 找到最后 发现引起的原因是:
Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in file

Could not load JDBC driver class [com.mysql.jdbc.Driver]

也就是 数据源这里出错,你仔细在看看 配置 ,或者看看jar 等原因

1 楼 yydriver 2013-08-07  
楼主,我是初学者,看了的实例,非常感谢如此详细的配置以及讲解
不过,我按照你的讲解配置以后,报错了。
在userAction中,userService不能注入。。。能帮忙分析一下么?那里错了
严重: StandardWrapper.Throwable
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userAction': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.service.IUserService com.action.userAction.userService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userServiceImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.dao.IUserDao com.service.UserServiceImpl.userdao; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userDaoImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.hibernate.SessionFactory com.conmmon.BaseDao.sessionFactory; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory' defined in file [D:\Develop\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\sopsoft2\WEB-INF\classes\spring-config.xml]: Cannot resolve reference to bean 'dataSource' while setting bean property 'dataSource'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dataSource' defined in file [D:\Develop\workspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\sopsoft2\WEB-INF\classes\spring-config.xml]: Error setting property values; nested exception is org.springframework.beans.PropertyBatchUpdateException; nested PropertyAccessExceptions (1) are:
PropertyAccessException 1: org.springframework.beans.MethodInvocationException: Property 'driverClassName' threw exception; nested exception is java.lang.IllegalStateException: Could not load JDBC driver class [com.mysql.jdbc.Driver]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:288)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1116)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:626)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
at org.springframework.web.servlet.FrameworkServlet.configureAndRefreshWebApplicationContext(FrameworkServlet.java:651)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:599)
at org.springframework.web.servlet.FrameworkServlet.createWebApplicationContext(FrameworkServlet.java:665)
at org.springframework.web.servlet.FrameworkServlet.initWebApplicationContext(FrameworkServlet.java:518)
at org.springframework.web.servlet.FrameworkServlet.initServletBean(FrameworkServlet.java:459)
at org.springframework.web.servlet.HttpServletBean.init(HttpServletBean.java:136)
at javax.servlet.GenericServlet.init(GenericServlet.java:160)
at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1280)
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1193)
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1088)
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5033)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5317)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559)
at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549)
at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
at java.util.concurrent.FutureTask.run(FutureTask.java:138)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
at java.lang.Thread.run(Thread.java:662)

相关推荐

    spring4+springmvc4+hibernate4 整合

    Spring、SpringMVC和Hibernate...总的来说,"spring4+springmvc4+hibernate4 整合"是一个深入学习和实践Java Web开发的重要主题。通过理解这三个框架的核心功能和整合方式,开发者能够构建出更加灵活、强大的应用系统。

    maven +spring3 +springmvc3 +hibernate4

    【标题】"maven +spring3 +springmvc3 +hibernate4" 是一个基于Maven构建的Web项目,它整合了Spring框架的三个主要组件:Spring Core、Spring MVC和Hibernate 4。这个项目旨在为初学者提供一个基础的参考模板,其中...

    Spring4+SpringMVC4+Hibernate4整合源码

    Spring4、SpringMVC4和Hibernate4是Java开发中非常重要的三个框架,它们分别负责不同的职责,共同构建了一个强大的企业级应用开发环境。Spring4作为核心框架,提供了依赖注入(DI)和面向切面编程(AOP)等功能,极...

    springmvc+spring+hibernate

    Spring MVC、Spring 和 Hibernate 是Java Web开发中的三大主流框架,它们各司其职,共同构建了一个强大而灵活的后端架构。Spring MVC 负责处理HTTP请求并将其路由到相应的控制器,Spring 提供了依赖注入(DI)和面向...

    springMVC+maven+hibernate框架

    springMVC+maven+hibernate框架,搭建的过程 可以参考 java进阶(五)------springMVC---springMVC+Hibernate+maven完整搭建运行步骤 http://blog.csdn.net/zzq900503/article/details/49892783

    springmvc3.2.2+mybatis3.2.2

    1、压缩包是一个 springmvc3.2.2 框架+mybatis3.2.2数据库操作层 的Eclipse工程 2、解压工程 修改数据库配置文件【dbConfig.xml】 编译 部署 发布 在本地或其他机器建一个表名为devType的两个字段的表,详情看映射...

    idea工具创建的Spring+SpringMVC+Hibernate+maven项目

    标题中的"idea工具创建的Spring+SpringMVC+Hibernate+maven项目"指的是使用IntelliJ IDEA这个集成开发环境(IDE)构建的一个Java Web项目,该项目整合了四个关键的技术框架:Spring、SpringMVC、Hibernate以及Maven...

    SSH - SpringMVC4 + Spring4 + Hibernate4 + c3p0 + Mysql.zip

    SSH是Java开发中的一种经典架构组合,代表Spring、Struts和Hibernate这三个开源框架的结合。在本项目"SSH - SpringMVC4 + Spring4 + Hibernate4 + c3p0 + Mysql.zip"中,开发者使用了SpringMVC4作为表现层,Spring4...

    基于Spring+SpringMVC+Hibernate的图书管理系统

    系统采用技术:Spring+SpringMVC+Hibernate+jQuery+Ajax+面向接口编程。 简介:该图书管理项目实现了三种角色的功能,分别是超级管理员,图书管理员和读者。在系统中,实现了图书管理,统计管理,系统管理和系统监控...

    基于SpringMVC+Hibernate实现的在线购物商城.zip

    基于springmvc+Hibernate实现的在线购物商城.zip基于springmvc+Hibernate实现的在线购物商城.zip基于springmvc+Hibernate实现的在线购物商城.zip基于springmvc+Hibernate实现的在线购物商城.zip基于springmvc+...

    springMVC3.2+Hibernate4的基本配置

    在本文中,我们将深入探讨如何配置一个基于SpringMVC 3.2和Hibernate 4的基础项目。这个项目配置涵盖了核心的框架组件,如数据库连接池、事务管理、缓存策略以及拦截器,这些是构建现代Java Web应用的关键要素。我们...

    Spring+SpringMVC+Hibernate框架集成详解

    Spring+SpringMVC+Hibernate 框架集成详解 本文档旨在详细介绍 Spring、SpringMVC 和 Hibernate 框架的集成,旨在帮助开发人员快速了解这三个框架的集成过程。 Spring 框架 Spring 框架是一个 Java 语言的开源...

    Maven整合Spring+SpringMVC+Hibernate+SpringDataJPA

    在现代Java Web开发中,"Maven整合Spring+SpringMVC+Hibernate+SpringDataJPA"是一个常见的架构组合,被广泛应用于构建企业级应用程序。这个组合通常被称为"SSM",其中"M"代表Maven,"S"代表Spring,包括Spring核心...

    maven(springmvc+spring+hibernate)

    Hibernate是一个优秀的对象关系映射(Object-Relational Mapping,ORM)框架,它简化了数据库操作。通过Hibernate,开发者可以使用面向对象的方式来操作数据库,避免了SQL语句的直接编写。SSH整合中,Hibernate作为...

    springMVC3.2+Hibernate4+freemarker

    springMVC3.2+Hibernate4+freemarker 代码框架采用springMVC3.2.4+hibernate4.2.8+freemarker2.3.16 功能方面只是一个简单的注册登录,前台使用freemarker渲染,使用了freemarker自定义标签。

    Spring+SpringMVC+Hibernate+JSP框架搭建

    "Spring+SpringMVC+Hibernate+JSP框架搭建"就是一个经典的Java Web开发解决方案,它整合了四个核心组件来实现全面的后端功能和用户界面交互。下面我们将深入探讨这四个组件以及它们如何协同工作。 1. **Spring框架*...

    springmvc+hibernate+easyui

    总结来说,"springmvc+hibernate+easyui"是一个使用SpringMVC作为MVC框架,Hibernate作为ORM工具,EasyUI作为前端组件库的典型企业级Web应用架构。它实现了菜单和数据列表的动态显示,使得系统具备了灵活的权限控制...

    spring3+springmvc+jpa+hibernate多数据源

    "spring3+springmvc+jpa+hibernate多数据源"是一个示例项目,它演示了如何在一个应用中集成Spring 3、Spring MVC、JPA 2.0以及Hibernate,以实现对多个数据源的支持。下面将详细介绍这些技术及其集成的关键点。 **...

    SpringMVC+HIbernate登录程序并进行增删改查

    SpringMVC+Hibernate登录程序并进行增删改查是一个经典的Web开发示例,它整合了两个重要的Java技术框架——SpringMVC和Hibernate,用于构建基于Java的动态网站应用。SpringMVC是Spring框架的一部分,主要负责处理...

Global site tag (gtag.js) - Google Analytics