Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?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:tx="http://www.springframework.org/schema/tx"
- xmlns:mvc="http://www.springframework.org/schema/mvc"
- 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.xsd
- http://www.springframework.org/schema/mvc
- http://www.springframework.org/schema/mvc/spring-mvc.xsd
- http://www.springframework.org/schema/tx
- http://www.springframework.org/schema/tx/spring-tx.xsd">
- <!-- Add support for component scanning -->
- <context:component-scan base-package="com.rsia.madura" />
- <!-- Add support for conversion, formatting and validation support -->
- <mvc:resources mapping="/resources/**" location="/resources/"/>
- <mvc:annotation-driven/>
- <!-- Define Spring MVC view resolver -->
- <bean
- class="org.springframework.web.servlet.view.InternalResourceViewResolver">
- <property name="prefix" value="/WEB-INF/view/" />
- <property name="suffix" value=".jsp" />
- </bean>
- <!-- Step 1: Define Database DataSource / connection pool -->
- <bean id="myDataSource" class="com.mchange.v2.c3p0.ComboPooledDataSource"
- destroy-method="close">
- <property name="driverClass" value="org.postgresql.Driver" />
- <property name="jdbcUrl" value="jdbc:postgresql://localhost:5432/rsia_madura" />
- <property name="user" value="postgres" />
- <property name="password" value="postgre" />
- <!-- these are connection pool properties for C3P0 -->
- <property name="minPoolSize" value="5" />
- <property name="maxPoolSize" value="20" />
- <property name="maxIdleTime" value="30000" />
- </bean>
- <!-- Step 2: Setup Hibernate session factory -->
- <bean id="sessionFactory"
- class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
- <property name="dataSource" ref="myDataSource" />
- <property name="packagesToScan" value="com.rsia.madura.entity" />
- <property name="hibernateProperties">
- <props>
- <prop key="hibernate.dialect">org.hibernate.dialect.PostgreSQLDialect</prop>
- <prop key="hibernate.show_sql">true</prop>
- </props>
- </property>
- </bean>
- <!-- Step 3: Setup Hibernate transaction manager -->
- <bean id="myTransactionManager"
- class="org.springframework.orm.hibernate5.HibernateTransactionManager">
- <property name="sessionFactory" ref="sessionFactory"/>
- </bean>
- <!-- Step 4: Enable configuration of transactional behavior based on annotations -->
- <tx:annotation-driven transaction-manager="myTransactionManager" />
- </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement