0
爲什麼它看起來像是多次登錄到我的MySQL數據庫?Spring 3啓動時的奇怪信息
INFO: Using JTA UserTransaction: [email protected]
INFO: Using JTA TransactionManager: [email protected]
INFO: Using JTA TransactionSynchronizationRegistry: com.su[email protected]18b5862
INFO: Root WebApplicationContext: initialization completed in 3354 ms
INFO: WEB0671: Loading application [com.g_mavenproject1_war_1.0-SNAPSHOT] at [/]
INFO: com._mavenproject1_war_1.0-SNAPSHOT was successfully deployed in 9,049 milliseconds.
INFO: Instantiated an instance of org.hibernate.validator.engine.resolver.JPATraversableResolver.
INFO: EclipseLink, version: Eclipse Persistence Services - 2.2.0.v20110202-r8913
CONFIG: connecting(DatabaseLogin(
platform=>MySQLPlatform
user name=> ""
connector=>JNDIConnector datasource name=>null
))
CONFIG: Connected: jdbc:mysql://localhost:3306/florblanca
User: [email protected]
Database: MySQL Version: 5.5.8
Driver: MySQL-AB JDBC Driver Version: mysql-connector-java-5.1.6 (Revision: ${svn.Revision})
CONFIG: connecting(DatabaseLogin(
platform=>MySQLPlatform
user name=> ""
connector=>JNDIConnector datasource name=>null
))
CONFIG: Connected: jdbc:mysql://localhost:3306/florblanca
User: [email protected]
Database: MySQL Version: 5.5.8
Driver: MySQL-AB JDBC Driver Version: mysql-connector-java-5.1.6 (Revision: ${svn.Revision})
INFO: file:/C:/Users/drewh/Desktop/mavenproject1/target/mavenproject1/WEB-INF/classes/_florblancaPU login successful
FINE: SELECT id, arrival, city, country, departure, email, guests, inserted, message, name, phone, sent, state, street, zip FROM contacts WHERE (id = ?)
bind => [1 parameter bound]
Spring配置:
<?xml version="1.0" encoding="windows-1252"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:tx="http://www.springframework.org/schema/tx"
xmlns:util="http://www.springframework.org/schema/util"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util-3.0.xsd
">
<context:component-scan base-package="com.atlanticpkg" />
<tx:annotation-driven transaction-manager="txManager"/>
<bean id="entityManagerFactory"
class="org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean">
<property name="persistenceUnitName" value="florblancaPU"/>
<property name="dataSource" ref="dataSource" />
<property name="jpaVendorAdapter">
<bean id="jpaAdapter" class="org.springframework.orm.jpa.vendor.EclipseLinkJpaVendorAdapter">
<property name="databasePlatform" value="org.eclipse.persistence.platform.database.MySQLPlatform" />
<property name="showSql" value="true" />
</bean>
</property>
</bean>
<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource">
<property name="driverClassName" value="com.mysql.jdbc.Driver"/>
<property name="url" value="jdbc:mysql://localhost/florblanca"/>
<property name="username" value="root"/>
<property name="password" value="password"/>
</bean>
<bean id="txManager" class="org.springframework.transaction.jta.JtaTransactionManager" />
</beans>
但我使用實體管理器。這難道不是所有的努力工作嗎?我從來沒有必要擔心它在ejb 3.1 –
但是,您的實體管理器使用Spring的配置文件中定義的DriverManagerDataSource對象。 –