Advertisement
Guest User

as

a guest
Apr 1st, 2017
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.62 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" xmlns:mvc="http://www.springframework.org/schema/mvc"
  4.        xmlns:context="http://www.springframework.org/schema/context"
  5.        xmlns:security="http://www.springframework.org/schema/c"
  6.        xsi:schemaLocation="
  7. http://www.springframework.org/schema/mvc
  8. http://www.springframework.org/schema/mvc/spring-mvc-4.0.xsd
  9. http://www.springframework.org/schema/beans
  10. http://www.springframework.org/schema/beans/spring-beans-4.0.xsd
  11. http://www.springframework.org/schema/context
  12. http://www.springframework.org/schema/context/spring-context-4.0.xsd
  13. http://www.springframework.org/schema/security
  14. http://www.springframework.org/schema/security/spring-security.xsd">
  15.  
  16.     <context:component-scan base-package="com.jonki" />
  17.     <context:annotation-config />
  18.     <mvc:annotation-driven />
  19.     <mvc:resources mapping="/resources/**" location="/WEB-INF/resources/" />
  20.     <security:global-method-security secured-annotations="enabled" pre-post-annotations="enabled" />
  21.  
  22.     <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  23.         <property name="prefix">
  24.             <value>/WEB-INF/views/</value>
  25.         </property>
  26.         <property name="suffix">
  27.             <value>.jsp</value>
  28.         </property>
  29.     </bean>
  30.  
  31.     <bean id="dataSource"
  32.           class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  33.         <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
  34.         <property name="url" value="jdbc:mysql://localhost:3306/mydatabase"/>
  35.         <property name="username" value="admin"/>
  36.         <property name="password" value="admin"/>
  37.     </bean>
  38.  
  39.     <bean id="sessionFactory"
  40.           class="org.springframework.orm.hibernate5.LocalSessionFactoryBean">
  41.         <property name="dataSource" ref="dataSource" />
  42.         <property name="hibernateProperties">
  43.             <props>
  44.                 <prop key="hibernate.show_sql">true</prop>
  45.                 <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
  46.                 <prop key="hibernate.hbm2ddl.auto">update</prop>
  47.             </props>
  48.         </property>
  49.         <property name="annotatedClasses">
  50.             <list>
  51.                 <value>com.jonki.Entity.User</value>
  52.             </list>
  53.         </property>
  54.     </bean>
  55.  
  56.     <bean id="transactionManager"
  57.           class="org.springframework.orm.hibernate5.HibernateTransactionManager">
  58.         <property name="sessionFactory" ref="sessionFactory" />
  59.     </bean>
  60.  
  61. </beans>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement