Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in / Register
Toggle navigation
S
spring-boot
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
DEMO
spring-boot
Commits
394f23a7
Commit
394f23a7
authored
Jan 20, 2015
by
Andy Wilkinson
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'gh-2348'
parents
e19bfd92
42e1a0b0
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
3 deletions
+61
-3
JpaProperties.java
...ngframework/boot/autoconfigure/orm/jpa/JpaProperties.java
+2
-2
HibernateJpaAutoConfigurationTests.java
...configure/orm/jpa/HibernateJpaAutoConfigurationTests.java
+59
-1
No files found.
spring-boot-autoconfigure/src/main/java/org/springframework/boot/autoconfigure/orm/jpa/JpaProperties.java
View file @
394f23a7
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -168,7 +168,7 @@ public class JpaProperties {
...
@@ -168,7 +168,7 @@ public class JpaProperties {
private
Map
<
String
,
String
>
getAdditionalProperties
(
Map
<
String
,
String
>
existing
,
private
Map
<
String
,
String
>
getAdditionalProperties
(
Map
<
String
,
String
>
existing
,
DataSource
dataSource
)
{
DataSource
dataSource
)
{
Map
<
String
,
String
>
result
=
new
HashMap
<
String
,
String
>();
Map
<
String
,
String
>
result
=
new
HashMap
<
String
,
String
>(
existing
);
if
(!
isAlreadyProvided
(
existing
,
"ejb.naming_strategy"
)
if
(!
isAlreadyProvided
(
existing
,
"ejb.naming_strategy"
)
&&
this
.
namingStrategy
!=
null
)
{
&&
this
.
namingStrategy
!=
null
)
{
result
.
put
(
"hibernate.ejb.naming_strategy"
,
this
.
namingStrategy
.
getName
());
result
.
put
(
"hibernate.ejb.naming_strategy"
,
this
.
namingStrategy
.
getName
());
...
...
spring-boot-autoconfigure/src/test/java/org/springframework/boot/autoconfigure/orm/jpa/HibernateJpaAutoConfigurationTests.java
View file @
394f23a7
/*
/*
* Copyright 2012-201
4
the original author or authors.
* Copyright 2012-201
5
the original author or authors.
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* you may not use this file except in compliance with the License.
...
@@ -16,11 +16,21 @@
...
@@ -16,11 +16,21 @@
package
org
.
springframework
.
boot
.
autoconfigure
.
orm
.
jpa
;
package
org
.
springframework
.
boot
.
autoconfigure
.
orm
.
jpa
;
import
java.util.Map
;
import
javax.sql.DataSource
;
import
javax.sql.DataSource
;
import
javax.transaction.Synchronization
;
import
javax.transaction.SystemException
;
import
javax.transaction.Transaction
;
import
javax.transaction.TransactionManager
;
import
javax.transaction.UserTransaction
;
import
org.hibernate.engine.transaction.jta.platform.spi.JtaPlatform
;
import
org.junit.Test
;
import
org.junit.Test
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.beans.factory.BeanCreationException
;
import
org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration
;
import
org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jta.JtaAutoConfiguration
;
import
org.springframework.boot.autoconfigure.jta.JtaProperties
;
import
org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration
;
import
org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration
;
import
org.springframework.boot.test.EnvironmentTestUtils
;
import
org.springframework.boot.test.EnvironmentTestUtils
;
import
org.springframework.jdbc.core.JdbcTemplate
;
import
org.springframework.jdbc.core.JdbcTemplate
;
...
@@ -138,4 +148,52 @@ public class HibernateJpaAutoConfigurationTests extends AbstractJpaAutoConfigura
...
@@ -138,4 +148,52 @@ public class HibernateJpaAutoConfigurationTests extends AbstractJpaAutoConfigura
this
.
context
.
refresh
();
this
.
context
.
refresh
();
}
}
@Test
public
void
testCustomJtaPlatform
()
throws
Exception
{
EnvironmentTestUtils
.
addEnvironment
(
this
.
context
,
"spring.jpa.properties.hibernate.transaction.jta.platform:"
+
TestJtaPlatform
.
class
.
getName
());
this
.
context
.
register
(
JtaProperties
.
class
,
JtaAutoConfiguration
.
class
);
setupTestConfiguration
();
this
.
context
.
refresh
();
Map
<
String
,
Object
>
jpaPropertyMap
=
this
.
context
.
getBean
(
LocalContainerEntityManagerFactoryBean
.
class
).
getJpaPropertyMap
();
assertThat
((
String
)
jpaPropertyMap
.
get
(
"hibernate.transaction.jta.platform"
),
equalTo
(
TestJtaPlatform
.
class
.
getName
()));
}
public
static
class
TestJtaPlatform
implements
JtaPlatform
{
@Override
public
TransactionManager
retrieveTransactionManager
()
{
throw
new
UnsupportedOperationException
();
}
@Override
public
UserTransaction
retrieveUserTransaction
()
{
throw
new
UnsupportedOperationException
();
}
@Override
public
Object
getTransactionIdentifier
(
Transaction
transaction
)
{
throw
new
UnsupportedOperationException
();
}
@Override
public
boolean
canRegisterSynchronization
()
{
throw
new
UnsupportedOperationException
();
}
@Override
public
void
registerSynchronization
(
Synchronization
synchronization
)
{
throw
new
UnsupportedOperationException
();
}
@Override
public
int
getCurrentStatus
()
throws
SystemException
{
throw
new
UnsupportedOperationException
();
}
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment