error reasons:
I had loaded the two xml struts.xml will complain if it does not matter only load one .
I wrote a load
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath*:beans.xml,
classpath*:applicationContext.xml,
</param-value>
</context-param>
two xml like this:
beans.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:context="http://www.springframework.org/schema/context"
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.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context-3.2.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.xsd"
>
<context:annotation-config />
<context:component-scan base-package="com.lee"></context:component-scan>
<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
<property name="locations"><value>classpath:jdbc.properties</value></property>
</bean>
<bean id="dbcp" class="org.apache.commons.dbcp.BasicDataSource" >
<property name="driverClassName" value="${jdbc.driverClassName}" />
<property name="url" value="${jdbc.url}"/>
<property name="username" value="${jdbc.username}" />
<property name="password" value="${jdbc.password}" />
</bean>
<bean id="sessionFactory" class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
<property name="dataSource" ref="dbcp" />
<!-- <property name="annotatedClasses">
<list>
<value>com.lee.model.User</value>
</list>
</property> -->
<property name="packagesToScan">
<list>
<value>com.lee.model</value>
</list>
</property>
<property name="hibernateProperties">
<value>
hibernate.dialect=org.hibernate.dialect.MySQLDialect
hibernate.show_sql=true
<!-- hibernate.hbm2ddl.auto=create -->
</value>
</property>
</bean>
<bean id="txManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"/>
</bean>
<aop:config>
<aop:pointcut id="serviceOperation" expression="execution(* com.lee..*.*(..))"/>
<aop:advisor advice-ref="txAdvice" pointcut-ref="serviceOperation"/>
</aop:config>
<tx:advice id="txAdvice" transaction-manager="txManager" >
<tx:attributes>
<!-- all methods starting with 'get' are read-only -->
<tx:method name="get*" read-only="true"/>
<!-- other methods use the default transaction settings (see below) -->
<tx:method name="save"/>
</tx:attributes>
</tx:advice>
</beans>
applicationContext.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd">
<beans default-autowire="autodetect">
<bean id="login" class="com.test.action.LoginAction" scope="prototype"/>
</beans>
with what ah ? A little too strange . Trouble you
------ Solution ------------------------------------- -------
page jump start error or operating error ?
struts.xml configuration file it ? Do not tell me the first one is the . .
In addition , contextConfigLocation try to remove the comma .
------ Solution ---------------------------------------- ----
classpath *: applicationContext.xml, remove the comma try
------ For reference only -------------------- -------------------
nobody knows ah
------ For reference only ----------------------- ----------------
------ For reference only ---------------------------------- -----
------ For reference only ---------------------------------------
没有评论:
发表评论