up
This commit is contained in:
parent
ad64dd9a33
commit
465e2bb536
@ -18,17 +18,17 @@
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-context</artifactId>
|
||||
<version>5.3.19</version>
|
||||
<version>5.3.27</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-web</artifactId>
|
||||
<version>6.0.0</version>
|
||||
<version>5.3.27</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-webmvc</artifactId>
|
||||
<version>6.0.9</version>
|
||||
<version>5.3.27</version>
|
||||
</dependency>
|
||||
|
||||
<!-- MyBatis -->
|
||||
|
40
project/web/WEB-INF/applicationContext.xml
Normal file
40
project/web/WEB-INF/applicationContext.xml
Normal file
@ -0,0 +1,40 @@
|
||||
<?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.xsd">
|
||||
<bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
|
||||
<property name="locations">
|
||||
<list>
|
||||
<value>classpath:db.properties</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="sqlSessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean">
|
||||
<property name="configLocation" value="classpath:mybatis-config.xml" />
|
||||
<property name="dataSource" ref="dataSource" />
|
||||
</bean>
|
||||
|
||||
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
|
||||
<property name="driverClassName" value="${db.driver}" />
|
||||
<property name="url" value="${db.url}" />
|
||||
<property name="username" value="${db.username}" />
|
||||
<property name="password" value="${db.password}" />
|
||||
</bean>
|
||||
|
||||
<!-- 配置其他 Bean -->
|
||||
<bean id="sqlSession" class="org.mybatis.spring.SqlSessionTemplate">
|
||||
<constructor-arg ref="sqlSessionFactory" />
|
||||
</bean>
|
||||
|
||||
<!-- 配置 AdminDao Bean -->
|
||||
<bean id="adminDao" class="cyou.chenx221.dao.impl.AdminDaoImpl">
|
||||
<constructor-arg ref="sqlSession" />
|
||||
</bean>
|
||||
|
||||
|
||||
<!-- 配置 AdminService Bean -->
|
||||
<bean id="adminService" class="cyou.chenx221.service.impl.AdminServiceImpl">
|
||||
<constructor-arg ref="adminDao" />
|
||||
</bean>
|
||||
</beans>
|
@ -1,6 +1,22 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<web-app xmlns="http://xmlns.jcp.org/xml/ns/javaee"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd"
|
||||
version="4.0">
|
||||
|
||||
<servlet>
|
||||
<servlet-name>dispatcher</servlet-name>
|
||||
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
|
||||
<init-param>
|
||||
<param-name>contextConfigLocation</param-name>
|
||||
<param-value>/WEB-INF/applicationContext.xml</param-value>
|
||||
</init-param>
|
||||
<load-on-startup>1</load-on-startup>
|
||||
</servlet>
|
||||
|
||||
<servlet-mapping>
|
||||
<servlet-name>dispatcher</servlet-name>
|
||||
<url-pattern>/</url-pattern>
|
||||
</servlet-mapping>
|
||||
|
||||
|
||||
</web-app>
|
Reference in New Issue
Block a user