Guest User

Untitled

a guest
Apr 6th, 2016
31
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.30 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <beans xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xmlns:mvc="http://www.springframework.org/schema/mvc"
  4. xmlns:tx="http://www.springframework.org/schema/tx"
  5. xmlns="http://www.springframework.org/schema/beans"
  6. xmlns:context="http://www.springframework.org/schema/context"
  7. xsi:schemaLocation="http://www.springframework.org/schema/beans
  8. http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
  9. http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd
  10. http://www.springframework.org/schema/context
  11. http://www.springframework.org/schema/context/spring-context.xsd
  12. http://www.springframework.org/schema/mvc
  13. http://www.springframework.org/schema/mvc/spring-mvc.xsd">
  14.  
  15. <context:component-scan base-package="com.kuzia.controller"/>
  16.  
  17. <mvc:resources mapping="/resourses/**" location="/resourses/" />
  18. <mvc:annotation-driven/>
  19.  
  20. <bean class="org.springframework.web.servlet.mvc.support.ControllerClassNameHandlerMapping" />
  21.  
  22.  
  23. <bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  24. <property name="prefix">
  25. <value>/WEB-INF/jsp/</value>
  26. </property>
  27. <property name="suffix">
  28. <value>.jsp</value>
  29. </property>
  30. </bean>
  31.  
  32. <context:component-scan base-package="com.kuzia"/>
  33. <bean id = "dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
  34. <property name="driverClassName" value="com.mysql.jdbc.Driver"/>
  35. <property name="url" value="jdbc:mysql://localhost:3306/basesites"/>
  36. <property name="username" value="root"/>
  37. <property name="password" value="root"/>
  38. </bean>
  39.  
  40.  
  41. <bean id = "sessionFactory" class = "org.springframework.orm.hibernate5.LocalSessionFactoryBean">
  42. <property name="dataSource" ref="dataSource"/>
  43. <property name="packagesToScan" value="com.kuzia.model"/>
  44. <property name="hibernateProperties">
  45. <value>
  46. hibernate.dialect=org.hibernate.dialect.MySQL5Dialect
  47. hibernate.show_sql=true
  48. </value>
  49. </property>
  50. </bean>
  51.  
  52. <bean id="entityManagerFactoryBean" class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
  53. <property name="dataSource" ref="dataSource"/>
  54.  
  55. <property name="packagesToScan" value="com.kuzia.model"/>
  56. <!-- JpaVendorAdapter implementation for Hibernate EntityManager.
  57. Exposes Hibernate's persistence provider and EntityManager extension interface -->
  58. <property name="jpaVendorAdapter">
  59. <bean class="org.springframework.orm.jpa.vendor.HibernateJpaVendorAdapter"/>
  60. </property>
  61. <property name="jpaProperties">
  62. <props>
  63. <prop key="hibernate.hbm2ddl.auto">update</prop>
  64. <prop key="hibernate.dialect">org.hibernate.dialect.MySQL5Dialect</prop>
  65. </props>
  66. </property>
  67. </bean>
  68.  
  69.  
  70. <tx:annotation-driven transaction-manager="tx" proxy-target-class="true"/>
  71. <bean id = "tx" class = "org.springframework.orm.hibernate5.HibernateTransactionManager">
  72. <property name="sessionFactory" ref="sessionFactory"/>
  73. </bean>
  74.  
  75. <bean id = "userDAO" class="com.kuzia.dao.impl.UserDAOImpl"/>
  76.  
  77. <bean id = "userService" class = "com.kuzia.service.impl.UserServiceImpl"/>
  78.  
  79. <bean id = "messageSource" class="org.springframework.context.support.ReloadableResourceBundleMessageSource">
  80. <property name="basename" value="classpath:messages"/>
  81. <property name="defaultEncoding" value="UTF-8"/>
  82. </bean>
  83.  
  84. <bean id = "localeChangeInterceptor" class = "org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
  85. <property name="paramName" value="lang"/>
  86. </bean>
  87.  
  88. <bean id = "localeResolver" class="org.springframework.web.servlet.i18n.CookieLocaleResolver">
  89. <property name="defaultLocale" value="en"/>
  90. </bean>
  91.  
  92. <mvc:interceptors>
  93. <bean class = "org.springframework.web.servlet.i18n.LocaleChangeInterceptor">
  94. <property name="paramName" value="lang"/>
  95. </bean>
  96. </mvc:interceptors>
  97. </beans>
Add Comment
Please, Sign In to add comment