Advertisement
Guest User

spring-context

a guest
Dec 10th, 2016
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 2.85 KB | None | 0 0
  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:context="http://www.springframework.org/schema/context" xmlns:tx="http://www.springframework.org/schema/tx"
  5.       xmlns:beans="http://www.springframework.org/schema/mvc"
  6.       xsi:schemaLocation="
  7.         http://www.springframework.org/schema/beans
  8.         http://www.springframework.org/schema/beans/spring-beans.xsd
  9.         http://www.springframework.org/schema/context
  10.         http://www.springframework.org/schema/context/spring-context.xsd
  11.         http://www.springframework.org/schema/tx
  12.         http://www.springframework.org/schema/tx/spring-tx.xsd
  13.         http://www.springframework.org/schema/mvc
  14.         http://www.springframework.org/schema/mvc/spring-mvc.xsd">
  15.  
  16.     <beans:bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource"
  17.                destroy-method="close">
  18.         <beans:property name="driverClassName" value="org.postgresql.Driver" />
  19.         <beans:property name="url"
  20.                        value="jdbc:postgresql://localhost:5432/users" />
  21.         <beans:property name="username" value="postgres" />
  22.         <beans:property name="password" value="postgres" />
  23.         <beans:property name="default_schema" value="public"/>
  24.     </beans:bean>
  25.  
  26.     <!-- Hibernate 4 SessionFactory Bean definition -->
  27.     <beans:bean id="hibernate4AnnotatedSessionFactory"
  28.                class="org.springframework.orm.hibernate4.LocalSessionFactoryBean">
  29.         <beans:property name="dataSource" ref="hibernate.cfg.xml" />
  30.         <beans:property name="annotatedClasses">
  31.             <beans:list>
  32.                 <beans:value>com.robertson.userManagement.model.User</beans:value>
  33.             </beans:list>
  34.         </beans:property>
  35.         <beans:property name="hibernateProperties">
  36.             <beans:props>
  37.                 <beans:prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect
  38.                 </beans:prop>
  39.                 <beans:prop key="hibernate.show_sql">true</beans:prop>
  40.             </beans:props>
  41.         </beans:property>
  42.     </beans:bean>
  43.  
  44.     <beans:bean id="userDao" class="com.robertson.userManagement.dao.UserDaoImpl">
  45.         <beans:property name="sessionFactory" ref="hibernate4AnnotatedSessionFactory" />
  46.     </beans:bean>
  47.     <beans:bean id="userService" class="com.robertson.userManagement.service.UserServiceImpl">
  48.         <beans:property name="userDao" ref="userDao"></beans:property>
  49.     </beans:bean>
  50.     <context:component-scan base-package="com.robertson.userManagement" />
  51.  
  52.  
  53.     <beans:bean id="transactionManager" class="org.springframework.orm.hibernate4.HibernateTransactionManager">
  54.         <beans:property name="sessionFactory" ref="hibernate4AnnotatedSessionFactory" />
  55.     </beans:bean>
  56.  
  57. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement