spring-config.
xml jueves, 15 de abril de 2021 11:02
1 <?xml version="1.0" encoding="UTF-8"?>
2 <beans xmlns="http://www.springframework.org/schema/beans"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4 xmlns:p="http://www.springframework.org/schema/p"
5 xmlns:context="http://www.springframework.org/schema/context"
6 xmlns:tx="http://www.springframework.org/schema/tx"
7 xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
8 http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
9 http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
10
11 <!-- Support annotation -->
12 <context:annotation-config />
13
14 <!-- support annotation transaction -->
15 <tx:annotation-driven
16 transaction-manager="txManager" />
17
18 <!-- declare datasource -->
19 <bean id="dataSource"
class="org.springframework.jdbc.datasource.DriverManagerDataSource">
20 <property name="driverClassName" value="com.mysql.jdbc.Driver" />
21 <property name="url" value="jdbc:mysql://localhost:3306/cdcol" />
22 <property name="username" value="root" />
23 <property name="password" value="" />
24 </bean>
25
26 <bean id="txManager"
27 class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
28 <property name="dataSource" ref="dataSource" />
29 </bean>
30
31 <!-- spring jdbc template -->
32 <bean id="jdbcTemplate"
33 class="org.springframework.jdbc.core.JdbcTemplate">
34 <property name="dataSource" ref="dataSource"></property>
35 </bean>
36
37 <!-- service -->
38 <bean id="userDetailService"
39 class="com.roytuts.spring.mvc.jdbc.service.impl.UserDetailServiceImpl" />
40
41 <!-- dao -->
42 <bean id="userDetailDao"
43 class="com.roytuts.spring.mvc.jdbc.dao.impl.UserDetailDaoImpl" />
44
45 </beans>
Page 1