exception information :
relevant code :
GivingRecordBusinessImpl.java
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.magus.farmgameclient.business.impl;
import com.magus.farmgameclient.business.BaseBusiness;
import com.magus.farmgameclient.constants.G;
import com.magus.farmgameclient.formbeans.TGameUserFormBean;
import com.magus.farmgameclient.models.TGameGivingRecord;
import com.magus.farmgameclient.models.TGameUser;
import com.magus.farmgameclient.models.TGameUserBag;
import com.magus.farmgameclient.services.TGameGivingRecordService;
import com.magus.farmgameclient.services.TGameUserBagService;
import com.magus.farmgameclient.services.TGameUserService;
import com.magus.shframework.helpers.JsonHelper;
import java.util.List;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.stereotype.Component;
/**
*
* @author gaoxiang
*/
@Component("givingRecordBusinessImpl")
public class GivingRecordBusinessImpl implements BaseBusiness{
private static final Log log = LogFactory.getLog(GivingRecordBusinessImpl.class);
@Resource(name = "tGameUserServiceImpl")
private TGameUserService tGameUserService;
@Resource(name = "tGameUserBagServiceImpl")
private TGameUserBagService tGameUserBagService;
@Resource(name = "tGameGivingRecordServiceImpl")
private TGameGivingRecordService tGameGivingRecordService;
@Override
public String process(HttpServletRequest request, TGameUserFormBean userFormBean) {
String jsonString = "";
try{
//判断用户是否存在
TGameUser user = tGameUserService.findById(TGameUser.class, Long.parseLong(userFormBean.getUserId()));
if(user==null){
jsonString = JsonHelper.setRespCodeAndRespMsg(G.RespCodeAndMsg.USER_NOT_EXISTS_CODE,
G.RespCodeAndMsg.USER_NOT_EXISTS_MSG);
return jsonString;
}
//处理分享到人人网的赠送逻辑
if(G.ActionId.SHARE_RENREN.equals(userFormBean.getActionId())){
List<TGameGivingRecord> givingrecordlist = tGameGivingRecordService.findGivingrecordOnTodayByType(user.getUserId(), G.ActionId.SHARE_RENREN);
if( givingrecordlist!=null){
jsonString = JsonHelper.setRespCodeAndRespMsg(G.RespCodeAndMsg.USER_REPEAT_SHARE_CODE,
G.RespCodeAndMsg.USER_REPEAT_SHARE_MSG);
return jsonString;
}
tGameUserBagService.givePropsBySys(G.ConstantsKey.SHARE_RENREN_AWARD, user.getUserId());
}
//处理分享到新浪微博的赠送逻辑
if(G.ActionId.SHARE_WEIBO.equals(userFormBean.getActionId())){
List<TGameGivingRecord> givingrecordlist = tGameGivingRecordService.findGivingrecordOnTodayByType(user.getUserId(), G.ActionId.SHARE_WEIBO);
if( givingrecordlist!=null){
jsonString = JsonHelper.setRespCodeAndRespMsg(G.RespCodeAndMsg.USER_REPEAT_SHARE_CODE,
G.RespCodeAndMsg.USER_REPEAT_SHARE_MSG);
return jsonString;
}
tGameUserBagService.givePropsBySys(G.ConstantsKey.SHARE_WEIBO_AWARD, user.getUserId());
}
//处理分享到微信的赠送逻辑
if(G.ActionId.SHARE_WEIXIN.equals(userFormBean.getActionId())){
List<TGameGivingRecord> givingrecordlist = tGameGivingRecordService.findGivingrecordOnTodayByType(user.getUserId(), G.ActionId.SHARE_WEIXIN);
if( givingrecordlist!=null){
jsonString = JsonHelper.setRespCodeAndRespMsg(G.RespCodeAndMsg.USER_REPEAT_SHARE_CODE,
G.RespCodeAndMsg.USER_REPEAT_SHARE_MSG);
return jsonString;
}
tGameUserBagService.givePropsBySys(G.ConstantsKey.SHARE_WEIXIN_AWARD, user.getUserId());
}
//处理第一次在线支付、并支付300赠送的逻辑
if(G.ActionId.FIRST_PAY_300.equals(userFormBean.getActionId())){
List<TGameGivingRecord> givingrecordlist = tGameGivingRecordService.findGivingrecordOnTodayByType(user.getUserId(), G.ActionId.FIRST_PAY_300);
if( givingrecordlist!=null){
jsonString = JsonHelper.setRespCodeAndRespMsg(G.RespCodeAndMsg.USER_REPEAT_PAY_CODE,
G.RespCodeAndMsg.USER_REPEAT_PAY_MSG);
return jsonString;
}
tGameUserBagService.givePropsBySys(G.ConstantsKey.FIRST_PAY_300_AWARD, user.getUserId());
}
//处理第一次在线支付、并支付500的逻辑
if(G.ActionId.FIRST_PAY_500.equals(userFormBean.getActionId())){
List<TGameGivingRecord> givingrecordlist = tGameGivingRecordService.findGivingrecordOnTodayByType(user.getUserId(), G.ActionId.FIRST_PAY_500);
if( givingrecordlist!=null){
jsonString = JsonHelper.setRespCodeAndRespMsg(G.RespCodeAndMsg.USER_REPEAT_PAY_CODE,
G.RespCodeAndMsg.USER_REPEAT_PAY_MSG);
return jsonString;
}
tGameUserBagService.givePropsBySys(G.ConstantsKey.FIRST_PAY_500_AWARD, user.getUserId());
}
//在线下单、并在线支付赠送的逻辑
if(G.ActionId.FIRST_PAY.equals(userFormBean.getActionId())){
List<TGameGivingRecord> givingrecordlist = tGameGivingRecordService.findGivingrecordOnTodayByType(user.getUserId(), G.ActionId.FIRST_PAY);
if( givingrecordlist!=null){
jsonString = JsonHelper.setRespCodeAndRespMsg(G.RespCodeAndMsg.USER_REPEAT_PAY_CODE,
G.RespCodeAndMsg.USER_REPEAT_PAY_MSG);
return jsonString;
}
tGameUserBagService.givePropsBySys(G.ConstantsKey.FIRST_PAY_AWARD, user.getUserId());
}
List<TGameUserBag> bagList = tGameUserBagService.findByProperty(TGameUserBag.class, "userId", user.getUserId());
String[] paramsName = {"propsList"};
Object[] paramsValue = {bagList};
jsonString = JsonHelper.toJson(G.RespCodeAndMsg.SUCCESS_CODE, G.RespCodeAndMsg.SUCCESS_MSG, paramsName, paramsValue);
}catch(Exception ex){
log.error("服务器异常!", ex);
jsonString = JsonHelper.setRespCodeAndRespMsg(G.RespCodeAndMsg.SERVER_EXCEPTION_CODE, G.RespCodeAndMsg.SERVER_EXCEPTION_MSG);
}
return jsonString;
}
}
TGameGivingRecordServiceImpl
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.magus.farmgameclient.services.impl;
import com.magus.farmgameclient.services.TGameGivingRecordService;
import com.magus.farmgameclient.daos.TGameGivingRecordDao;
import com.magus.farmgameclient.daos.TGameUserBagDao;
import com.magus.farmgameclient.models.TGameGivingRecord;
import com.magus.farmgameclient.services.TGameUserBagService;
import com.magus.shframework.helpers.CommonHelper;
import com.magus.shframework.services.impl.BaseServiceImpl;
import java.sql.Timestamp;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.annotation.Resource;
import org.springframework.stereotype.Service;
/**
*
* @author gaoxiang
*/
@Service("tGameGivingRecordServiceImpl")
public class TGameGivingRecordServiceImpl extends BaseServiceImpl<TGameGivingRecord, Long> implements TGameGivingRecordService {
@Resource(name="TGameGivingRecordDaoImpl")
private TGameGivingRecordDao tGameGivingRecordDao;
@Resource(name = "tGameUserBagDaoImpl")
private TGameUserBagDao tGameUserBagDao;
@Resource(name = "tGameUserBagServiceImpl")
private TGameUserBagService tGameUserBagService;
/*
* 查找用户指定操作的赠送记录
* @param userId 用户id
* @param actionId 操作类型(分享(QQ空间/微博/人人/微信)、在线支付、第一次在线支付并达到一定的额度),如果为空就是所有操作
*/
@Override
public List<TGameGivingRecord> findGivingrecordOnTodayByType(Long userId,String actionId){
List<TGameGivingRecord> givingrecordlist = null;
Date curDate = new Date();
Timestamp startTimestampToday = new Timestamp (CommonHelper.calculatorStartTimeOnDay(curDate));
String hql = "from TGameGivingrecord gr Where gr.userId=:userId and gr.actionId=:actionId"+
"and gr.createTime>=:startTimestampToday and op.createTime <= current_timestamp order by op.createTime desc";
Map<String, Object> paramsMap = new HashMap<String, Object>();
paramsMap.put("userId", userId);
paramsMap.put("startTimestampToday", startTimestampToday);
if(actionId==null){
hql = "rom TGameGivingrecord gr Where gr.userId=:userId "+
"and gr.createTime>=:startTimestampToday and op.createTime <= current_timestamp order by op.createTime desc";
}else {
paramsMap.put("actionId", actionId);
}
givingrecordlist = tGameGivingRecordDao.find(hql, paramsMap);
return givingrecordlist;
}
}
------ Solution ------------------------------------ --------
+1
------ Solution --------------------------- -----------------
injected when the name was to ensure consistent injection , @ Repository ("tGameGivingRecordDaoImpl") named in lowercase , you have to reference elsewhere lowercase . No bean named 'TGameGivingRecordDaoImpl' is defined obvious hint here is an uppercase T
------ For reference only ----------------- ----------------------
how successful it would not inject ? ? All configuration files are correct. .
------ For reference only -------------------------------------- -
you should put all the error messages posted, did not see the screenshot wrong reasons , because you're the last one estimate is wrong, attention to the case .
------ For reference only -------------------------------------- -
configuration file was posted out
------ For reference only ----------------------------- ----------
十月 31, 2013 4:43:55 下午 org.apache.catalina.core.ApplicationContext log
INFO: No Spring WebApplicationInitializer types detected on classpath
十月 31, 2013 4:43:56 下午 org.apache.catalina.core.ApplicationContext log
INFO: Initializing Spring root WebApplicationContext
十月 31, 2013 4:44:04 下午 org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class com.magus.farmgameclient.listeners.CustomerContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'givingRecordBusinessImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tGameGivingRecordServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'TGameGivingRecordDaoImpl' is defined
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:306)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:193)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:607)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:925)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:472)
at org.springframework.web.context.ContextLoader.configureAndRefreshWebApplicationContext(ContextLoader.java:388)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:293)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:111)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939)
at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434)
at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
at org.apache.catalina.startup.HostConfig.checkResources(HostConfig.java:1275)
at org.apache.catalina.startup.HostConfig.check(HostConfig.java:1439)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:315)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:119)
at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:90)
at org.apache.catalina.core.ContainerBase.backgroundProcess(ContainerBase.java:1374)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1530)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.processChildren(ContainerBase.java:1540)
at org.apache.catalina.core.ContainerBase$ContainerBackgroundProcessor.run(ContainerBase.java:1519)
at java.lang.Thread.run(Thread.java:722)
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'tGameGivingRecordServiceImpl': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'TGameGivingRecordDaoImpl' is defined
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:306)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1106)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:517)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:294)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:225)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:442)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:416)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:550)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:155)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:92)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:303)
... 26 more
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'TGameGivingRecordDaoImpl' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:549)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1095)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:277)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:442)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:416)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:550)
at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:155)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:92)
at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:303)
... 39 more
十月 31, 2013 4:44:04 下午 org.apache.catalina.core.ApplicationContext log
INFO: Closing Spring root WebApplicationContext
------ For reference only ----------------------------------- ----
TGameGivingRecordDaoImpl sent to this class .
------ For reference only -------------------------------------- -
configuration file was posted out
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.4" xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
<display-name>mavenproject1</display-name>
<!-- Spring Encoding Filter -->
<filter>
<filter-name>springEncoding</filter-name>
<filter-class>
org.springframework.web.filter.CharacterEncodingFilter
</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
<init-param>
<param-name>forceEncoding</param-name>
<param-value>true</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>springEncoding</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Config Session Lazy Loading -->
<filter>
<filter-name>springOpenSessionView</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
<init-param>
<param-name>sessionFactoryBeanName</param-name>
<param-value>sessionFactory</param-value>
</init-param>
<init-param>
<param-name>singleSession</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>flushMode</param-name>
<param-value>AUTO</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>springOpenSessionView</filter-name>
<url-pattern>*.json</url-pattern>
</filter-mapping>
<!-- Spring Listener -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>/WEB-INF/applicationContext.xml</param-value>
</context-param>
<!-- <listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>-->
<listener>
<listener-class>com.magus.farmgameclient.listeners.CustomerContextLoaderListener</listener-class>
</listener>
<!-- Spring MVC Dispatcher Servlet -->
<servlet>
<servlet-name>dispatcher</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>dispatcher</servlet-name>
<url-pattern>*.json</url-pattern>
</servlet-mapping>
<resource-ref>
<res-ref-name>jdbc/lifepayment</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
<!-- Session Expire Time (unit:min) -->
<session-config>
<session-timeout>
30
</session-timeout>
</session-config>
<!-- Index Page -->
<welcome-file-list>
<welcome-file>test.jsp</welcome-file>
</welcome-file-list>
</web-app>
------ For reference only ---------------------------------- -----
applicationContext.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:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd" xmlns:context="http://www.springframework.org/schema/context"
default-autowire="byName">
<!-- Property Placeholder Configurer -->
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations">
<list>
<value>classpath*:springConfigFile.properties</value>
</list>
</property>
</bean>
<context:component-scan base-package="com.magus">
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Controller" />
</context:component-scan>
<!-- jdbc dataSource -->
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="${dataSource.jdbc.driverClassName}" />
<property name="url" value="${dataSource.jdbc.url}" />
<property name="username" value="${dataSource.jdbc.username}" />
<property name="password" value="${dataSource.jdbc.password}" />
</bean>
<!--
<bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true">
<property name="jndiName">
<value>java:comp/env/jdbc/lifepayment</value>
</property>
</bean>
-->
<!-- c3p0 dataSource
<bean id="dataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource">
<property name="driverClass" value="org.postgresql.Driver" />
<property name="jdbcUrl" value="jdbc:postgresql://qa.fun-guide.mobi:5432/cmbcoupon" />
<property name="user" value="pgsql" />
<property name="password" value="pgsql" />
<property name="minPoolSize">
<value>3</value>
</property>
<property name="maxPoolSize">
<value>10</value>
</property>
<property name="initialPoolSize">
<value>5</value>
</property>
<property name="maxIdleTime">
<value>60</value>
</property>
<property name="acquireIncrement">
<value>5</value>
</property>
<property name="maxStatements">
<value>0</value>
</property>
<property name="idleConnectionTestPeriod">
<value>60</value>
</property>
<property name="acquireRetryAttempts">
<value>30</value>
</property>
<property name="breakAfterAcquireFailure">
<value>true</value>
</property>
<property name="testConnectionOnCheckout">
<value>false</value>
</property>
</bean>
-->
<!-- 这个是基于注解的 -->
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.annotation.AnnotationSessionFactoryBean">
<property name="dataSource" >
<ref bean="dataSource" />
</property>
<property name="hibernateProperties">
<props>
<prop key="hibernate.dialect">${hibernate.dialect}</prop>
<prop key="hibernate.connection.autocommit">${hibernate.connection.autocommit}</prop>
<prop key="hibernate.show_sql">${hibernate.show_sql}</prop>
</props>
</property>
<property name="packagesToScan">
<list>
<value>com.magus.*</value>
</list>
</property>
</bean>
<!-- Spring Transaction Manager -->
<bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory">
<ref local="sessionFactory"></ref>
</property>
</bean>
<tx:annotation-driven transaction-manager="transactionManager" />
</beans>
dispatcher-servlet.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:p="http://www.springframework.org/schema/p"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd" xmlns:context="http://www.springframework.org/schema/context"
default-autowire="byName">
<context:component-scan base-package="com.magus" >
<context:include-filter type="annotation" expression="org.springframework.stereotype.Controller" />
<context:exclude-filter type="annotation" expression="org.springframework.stereotype.Service" />
</context:component-scan>
<!--
<bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping"/>
<bean class="org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter"/>
-->
<bean class="org.springframework.web.servlet.mvc.annotation.DefaultAnnotationHandlerMapping"/>
<bean id="validator"
class="org.springframework.validation.beanvalidation.LocalValidatorFactoryBean"/>
<bean class="org.springframework.web.servlet.mvc.annotation.AnnotationMethodHandlerAdapter">
<property name="webBindingInitializer">
<bean class="org.springframework.web.bind.support.ConfigurableWebBindingInitializer">
<!-- <property name="conversionService" ref="conversionService" />-->
<property name="validator" ref="validator" />
</bean>
</property>
<property name="messageConverters">
<list>
<bean class="org.springframework.http.converter.StringHttpMessageConverter">
<property name="supportedMediaTypes">
<list>
<value>text/plain;charset=UTF-8</value>
</list>
</property>
</bean>
<!-- <bean class="org.springframework.http.converter.ByteArrayHttpMessageConverter" />
<bean class="org.springframework.http.converter.FormHttpMessageConverter" />
<bean class="org.springframework.http.converter.xml.SourceHttpMessageConverter" />
<bean class="org.springframework.http.converter.json.MappingJacksonHttpMessageConverter" />-->
</list>
</property>
</bean>
<bean class="org.springframework.web.servlet.mvc.HttpRequestHandlerAdapter"/>
<!--
Most controllers will use the ControllerClassNameHandlerMapping above, but
for the index controller we are using ParameterizableViewController, so we must
define an explicit mapping for it.
-->
<bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
<property name="mappings">
<props>
<prop key="index.htm">indexController</prop>
</props>
</property>
</bean>
<bean id="viewResolver"
class="org.springframework.web.servlet.view.InternalResourceViewResolver"
p:prefix="/WEB-INF/jsp/"
p:suffix=".jsp" />
<!--
The index controller.
-->
<bean name="indexController"
class="org.springframework.web.servlet.mvc.ParameterizableViewController"
p:viewName="index" />
</beans>
------ For reference only ---------------------------------- -----
+1
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package com.magus.farmgameclient.daos.impl;
import com.magus.farmgameclient.daos.TGameGivingRecordDao;
import com.magus.farmgameclient.models.TGameGivingRecord;
import com.magus.shframework.daos.impl.BaseDaoImpl;
import org.springframework.stereotype.Repository;
/**
*
* @author gaoxiang
*/
@Repository("tGameGivingRecordDaoImpl")
public class TGameGivingRecordDaoImpl extends BaseDaoImpl<TGameGivingRecord, Long> implements TGameGivingRecordDao {
}
------ For reference only ----------------------------------- ----
er er. . . Thank you ! ! Introduced in Service layer . . Downright careless . . Has been found. . Thank you ! ! ! ! Given to you. . .
没有评论:
发表评论