Advertisement
Guest User

Untitled

a guest
Feb 11th, 2017
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 5.91 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <persistence xmlns="http://java.sun.com/xml/ns/persistence" version="2.0">
  3.  
  4. <persistence-unit name="defaultPersistenceUnit" transaction-type="RESOURCE_LOCAL">
  5. <provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
  6. <properties>
  7. <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5Dialect"/>
  8. <property name="hibernate.connection.url"
  9. value="jdbc:mysql://localhost:3306/springdemo"/>
  10. <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
  11. <property name="hibernate.connection.username" value="root"/>
  12. <property name="hibernate.connection.password" value="hukangze"/>
  13. <property name="hibernate.show_sql" value="true"/>
  14.  
  15. <property name="hibernate.connection.useUnicode" value="true"/>
  16. <property name="hibernate.connection.characterEncoding" value="UTF-8"/>
  17.  
  18. <property name="hibernate.format_sql" value="true"/>
  19. <property name="hibernate.use_sql_comments" value="false"/>
  20. <property name="hibernate.hbm2ddl.auto" value="update"/>
  21.  
  22. <property name="hibernate.connection.autoReconnect" value="true"/>
  23. <property name="connection.autoReconnectForPools" value="true"/>
  24. <property name="connection.is-connection-validation-required" value="true"/>
  25. </properties>
  26. </persistence-unit>
  27. </persistence>
  28.  
  29. <?xml version="1.0" encoding="UTF-8"?>
  30. <beans xmlns="http://www.springframework.org/schema/beans"
  31. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  32. xmlns:context="http://www.springframework.org/schema/context"
  33. xmlns:mvc="http://www.springframework.org/schema/mvc" xmlns:jpa="http://www.springframework.org/schema/data/jpa"
  34. xmlns:tx="http://www.springframework.org/schema/tx"
  35. 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/data/jpa http://www.springframework.org/schema/data/jpa/spring-jpa.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd">
  36.  
  37. <context:component-scan base-package="com.ssh.controller"/>
  38.  
  39. <mvc:default-servlet-handler/>
  40.  
  41. <mvc:annotation-driven/>
  42.  
  43. <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
  44. <property name="viewClass" value="org.springframework.web.servlet.view.JstlView"/>
  45. <property name="prefix" value="/WEB-INF/pages/"/>
  46. <property name="suffix" value=".jsp"/>
  47. </bean>
  48.  
  49. <jpa:repositories base-package="com.ssh.repository"/>
  50.  
  51. <bean id="entityManagerFactory" class="org.springframework.orm.jpa.LocalEntityManagerFactoryBean">
  52. <property name="persistenceUnitName" value="defaultPersistenceUnit"/>
  53. </bean>
  54.  
  55. <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
  56. <property name="entityManagerFactory" value="entityManagerFactory"/>
  57. </bean>
  58.  
  59. <tx:annotation-driven transaction-manager="transactionManager"/>
  60. </beans>
  61.  
  62. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'javax.persistence.EntityManagerFactory' for property 'entityManagerFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'javax.persistence.EntityManagerFactory' for property 'entityManagerFactory': no matching editors or conversion strategy found
  63. Caused by: org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'javax.persistence.EntityManagerFactory' for property 'entityManagerFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'javax.persistence.EntityManagerFactory' for property 'entityManagerFactory': no matching editors or conversion strategy found
  64. Caused by: java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'javax.persistence.EntityManagerFactory' for property 'entityManagerFactory': no matching editors or conversion strategy found
  65. org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'transactionManager' defined in ServletContext resource [/WEB-INF/mvc-dispatcher-servlet.xml]: Initialization of bean failed; nested exception is org.springframework.beans.ConversionNotSupportedException: Failed to convert property value of type 'java.lang.String' to required type 'javax.persistence.EntityManagerFactory' for property 'entityManagerFactory'; nested exception is java.lang.IllegalStateException: Cannot convert value of type 'java.lang.String' to required type 'javax.persistence.EntityManagerFactory' for property 'entityManagerFactory': no matching editors or conversion strategy found
  66.  
  67. <bean id="transactionManager" class="org.springframework.orm.jpa.JpaTransactionManager">
  68. <property name="entityManagerFactory" value="entityManagerFactory"/>
  69. </bean>
  70.  
  71. <tx:annotation-driven transaction-manager="transactionManager"/>
  72.  
  73. <property name="entityManagerFactory" value="entityManagerFactory"/>
  74.  
  75. <property name="entityManagerFactory" ref="entityManagerFactory"/>
  76.  
  77. <property name="entityManagerFactory" value="entityManagerFactory"/>
  78.  
  79. <property name="entityManagerFactory" ref="entityManagerFactory" />
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement