一共有好几个配置文件`分别是下面的`
为什么每次提交INFO请求的时候说是找不找/info
可是`当我把这几个文件合并到applicationContext.xml里的时候`就可以正常进/info了
applicationContext.xml
- XML code
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"> <property name="driverClassName" value="com.mysql.jdbc.Driver"> </property> <property name="url" value="jdbc:mysql://localhost:3306/mydb"></property> <property name="username" value="root"></property> </bean> <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean"> <property name="dataSource"> <ref bean="dataSource" /> </property> <property name="hibernateProperties"> <props> <prop key="hibernate.dialect"> org.hibernate.dialect.MySQLDialect </prop> <prop key="hibernate_show">true</prop> </props> </property> <property name="mappingResources"> <list> <value>com/ssh/entity/Info.hbm.xml</value></list> </property></bean></beans>
applicationContextAction.xml
- XML code
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean name="/info" class="com.ssh.web.action.InfoAction"> <property name="biz"> <ref bean="InfoBiz"/> </property> </bean></beans>
applicationContextBiz.xml
- XML code
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean id="InfoBiz" class="com.ssh.biz.impl.InfoBizImpl"> <property name="dao"> <ref bean="InfoDao"/> </property> </bean></beans>
applicationContextDao.xml
- XML code
<?xml version="1.0" encoding="UTF-8"?><beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd"> <bean id="InfoDao" class="com.ssh.dao.impl.InfoDaoImpl"> <property name="sessionFactory" > <ref bean="sessionFactory"/> </property> </bean></beans>