mirror of
https://github.com/spring-projects/spring-boot.git
synced 2024-09-03 04:26:12 +08:00
Change default for new_generator_mappings to true
Closes gh-7612
This commit is contained in:
parent
1ad318d8a6
commit
bc1ee76b55
@ -202,7 +202,7 @@ public class JpaProperties {
|
||||
this.useNewIdGeneratorMappings.toString());
|
||||
}
|
||||
else if (!result.containsKey(USE_NEW_ID_GENERATOR_MAPPINGS)) {
|
||||
result.put(USE_NEW_ID_GENERATOR_MAPPINGS, "false");
|
||||
result.put(USE_NEW_ID_GENERATOR_MAPPINGS, "true");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -108,17 +108,17 @@ public class JpaPropertiesTests {
|
||||
Map<String, String> hibernateProperties = properties
|
||||
.getHibernateProperties(mockStandaloneDataSource());
|
||||
assertThat(hibernateProperties)
|
||||
.containsEntry(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "false");
|
||||
.containsEntry(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true");
|
||||
}
|
||||
|
||||
@Test
|
||||
public void useNewIdGeneratorMappingsTrue() throws Exception {
|
||||
public void useNewIdGeneratorMappingsFalse() throws Exception {
|
||||
JpaProperties properties = load(
|
||||
"spring.jpa.hibernate.use-new-id-generator-mappings:true");
|
||||
"spring.jpa.hibernate.use-new-id-generator-mappings:false");
|
||||
Map<String, String> hibernateProperties = properties
|
||||
.getHibernateProperties(mockStandaloneDataSource());
|
||||
assertThat(hibernateProperties)
|
||||
.containsEntry(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "true");
|
||||
.containsEntry(AvailableSettings.USE_NEW_ID_GENERATOR_MAPPINGS, "false");
|
||||
}
|
||||
|
||||
@Test
|
||||
|
@ -48,7 +48,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
@SpringBootTest
|
||||
// Enable JMX so we can test the MBeans (you can't do this in a properties file)
|
||||
@TestPropertySource(properties = { "spring.jmx.enabled:true",
|
||||
"spring.datasource.jmx-enabled:true" })
|
||||
"spring.datasource.jmx-enabled:true", "spring.jpa.hibernate.use-new-id-generator-mappings=false" })
|
||||
@ActiveProfiles("scratch")
|
||||
// Separate profile for web tests to avoid clashing databases
|
||||
public class SampleDataJpaApplicationTests {
|
||||
|
@ -23,6 +23,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@ -34,6 +35,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
|
||||
public class CityRepositoryIntegrationTests {
|
||||
|
||||
@Autowired
|
||||
|
@ -30,6 +30,7 @@ import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Sort.Direction;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@ -41,6 +42,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
|
||||
public class HotelRepositoryIntegrationTests {
|
||||
|
||||
@Autowired
|
||||
|
@ -23,6 +23,7 @@ import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.ActiveProfiles;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
|
||||
@ -44,6 +45,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
|
||||
@ActiveProfiles("scratch")
|
||||
// Separate profile for web tests to avoid clashing databases
|
||||
public class SampleDataRestApplicationTests {
|
||||
|
@ -24,6 +24,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.data.domain.Page;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
@ -36,6 +37,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
|
||||
public class CityRepositoryIntegrationTests {
|
||||
|
||||
@Autowired
|
||||
|
@ -22,12 +22,14 @@ import org.junit.runner.RunWith;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.jdbc.core.JdbcTemplate;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
|
||||
public class SampleFlywayApplicationTests {
|
||||
|
||||
@Autowired
|
||||
|
@ -22,6 +22,7 @@ import org.junit.runner.RunWith;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.test.context.web.WebAppConfiguration;
|
||||
import org.springframework.test.web.servlet.MockMvc;
|
||||
@ -40,6 +41,7 @@ import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
|
||||
@WebAppConfiguration
|
||||
public class SampleJpaApplicationTests {
|
||||
|
||||
|
@ -23,6 +23,7 @@ import sample.jpa.domain.Note;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -35,6 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
|
||||
@Transactional
|
||||
public class JpaNoteRepositoryIntegrationTests {
|
||||
|
||||
|
@ -23,6 +23,7 @@ import sample.jpa.domain.Tag;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.boot.test.context.SpringBootTest;
|
||||
import org.springframework.test.context.TestPropertySource;
|
||||
import org.springframework.test.context.junit4.SpringRunner;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@ -35,6 +36,7 @@ import static org.assertj.core.api.Assertions.assertThat;
|
||||
*/
|
||||
@RunWith(SpringRunner.class)
|
||||
@SpringBootTest
|
||||
@TestPropertySource(properties = "spring.jpa.hibernate.use-new-id-generator-mappings=false")
|
||||
@Transactional
|
||||
public class JpaTagRepositoryIntegrationTests {
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user