Skip to content

Commit

Permalink
Upgrade spring-boot version to 2.0.0.M3
Browse files Browse the repository at this point in the history
* Spring Boot version upgraded
* Replace deprecated methods

Fixes gh-163
  • Loading branch information
eddumelendez committed Aug 20, 2017
1 parent 5dd1093 commit 943e56f
Show file tree
Hide file tree
Showing 2 changed files with 80 additions and 55 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration;
import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration;
import org.springframework.boot.test.util.EnvironmentTestUtils;
import org.springframework.boot.test.util.TestPropertyValues;
import org.springframework.context.annotation.AnnotationConfigApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
Expand Down Expand Up @@ -104,8 +105,7 @@ public void testDefaultConfiguration() {

@Test
public void testWithConfigLocation() {
EnvironmentTestUtils.addEnvironment(this.context,
"mybatis.config-location:mybatis-config.xml");
TestPropertyValues.of("mybatis.config-location:mybatis-config.xml").applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisAutoConfiguration.class, MybatisMapperConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
Expand All @@ -119,8 +119,7 @@ public void testWithConfigLocation() {
@Test
public void testWithConfig() {
// test for compatibility with 1.0.x
EnvironmentTestUtils.addEnvironment(this.context,
"mybatis.config:mybatis-config.xml");
TestPropertyValues.of("mybatis.config:mybatis-config.xml").applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisAutoConfiguration.class, MybatisMapperConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
Expand All @@ -133,9 +132,8 @@ public void testWithConfig() {

@Test
public void testWithCheckConfigLocationFileExists() {
EnvironmentTestUtils
.addEnvironment(this.context, "mybatis.config-location:mybatis-config.xml",
"mybatis.check-config-location=true");
TestPropertyValues.of("mybatis.config-location:mybatis-config.xml",
"mybatis.check-config-location=true").applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisAutoConfiguration.class);
this.context.refresh();
Expand All @@ -144,8 +142,7 @@ public void testWithCheckConfigLocationFileExists() {

@Test
public void testWithCheckConfigLocationFileNotSpecify() {
EnvironmentTestUtils.addEnvironment(this.context,
"mybatis.check-config-location=true");
TestPropertyValues.of("mybatis.check-config-location=true").applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisAutoConfiguration.class);
this.context.refresh();
Expand All @@ -155,8 +152,9 @@ public void testWithCheckConfigLocationFileNotSpecify() {
@Test
public void testWithCheckConfigLocationFileDoesNotExists() {

EnvironmentTestUtils.addEnvironment(this.context, "mybatis.config-location:foo.xml",
"mybatis.check-config-location=true");
TestPropertyValues.of("mybatis.config-location:foo.xml",
"mybatis.check-config-location=true")
.applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisAutoConfiguration.class);

Expand All @@ -170,8 +168,8 @@ public void testWithCheckConfigLocationFileDoesNotExists() {

@Test
public void testWithTypeHandlersPackage() {
EnvironmentTestUtils.addEnvironment(this.context,
"mybatis.type-handlers-package:org.mybatis.spring.boot.autoconfigure.handler");
TestPropertyValues.of("mybatis.type-handlers-package:org.mybatis.spring.boot.autoconfigure.handler")
.applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
Expand All @@ -183,9 +181,10 @@ public void testWithTypeHandlersPackage() {

@Test
public void testWithMapperLocation() {
EnvironmentTestUtils.addEnvironment(this.context,
TestPropertyValues.of(
"mybatis.type-aliases-package:org.mybatis.spring.boot.autoconfigure.domain",
"mybatis.mapper-locations:classpath:org/mybatis/spring/boot/autoconfigure/repository/CityMapper.xml");
"mybatis.mapper-locations:classpath:org/mybatis/spring/boot/autoconfigure/repository/CityMapper.xml")
.applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
Expand All @@ -195,8 +194,9 @@ public void testWithMapperLocation() {

@Test
public void testWithExecutorType() {
EnvironmentTestUtils.addEnvironment(this.context,
"mybatis.config-location:mybatis-config.xml", "mybatis.executor-type:REUSE");
TestPropertyValues.of(
"mybatis.config-location:mybatis-config.xml", "mybatis.executor-type:REUSE")
.applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisAutoConfiguration.class, MybatisMapperConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
Expand Down Expand Up @@ -241,8 +241,9 @@ public void testWithDatabaseIdProvider() {

@Test
public void testMixedWithConfigurationFileAndInterceptor() {
EnvironmentTestUtils.addEnvironment(this.context,
"mybatis.config-location:mybatis-config-settings-only.xml");
TestPropertyValues.of(
"mybatis.config-location:mybatis-config-settings-only.xml")
.applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisInterceptorConfiguration.class);
this.context.refresh();
Expand All @@ -259,8 +260,9 @@ public void testMixedWithConfigurationFileAndInterceptor() {

@Test
public void testMixedWithConfigurationFileAndDatabaseIdProvider() {
EnvironmentTestUtils.addEnvironment(this.context,
"mybatis.config-location:mybatis-config-settings-only.xml");
TestPropertyValues.of(
"mybatis.config-location:mybatis-config-settings-only.xml")
.applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisBootMapperScanAutoConfiguration.class,
DatabaseProvidersConfiguration.class);
Expand All @@ -277,10 +279,10 @@ public void testMixedWithConfigurationFileAndDatabaseIdProvider() {

@Test
public void testMixedWithConfigurationFileAndTypeHandlersPackage() {
EnvironmentTestUtils
.addEnvironment(this.context,
"mybatis.config-location:mybatis-config-settings-only.xml",
"mybatis.type-handlers-package:org.mybatis.spring.boot.autoconfigure.handler");
TestPropertyValues.of(
"mybatis.config-location:mybatis-config-settings-only.xml",
"mybatis.type-handlers-package:org.mybatis.spring.boot.autoconfigure.handler")
.applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisBootMapperScanAutoConfiguration.class);
this.context.refresh();
Expand All @@ -296,12 +298,11 @@ public void testMixedWithConfigurationFileAndTypeHandlersPackage() {

@Test
public void testMixedWithConfigurationFileAndTypeAliasesPackageAndMapperLocations() {
EnvironmentTestUtils
.addEnvironment(
this.context,
"mybatis.config-location:mybatis-config-settings-only.xml",
"mybatis.type-aliases-package:org.mybatis.spring.boot.autoconfigure.domain",
"mybatis.mapper-locations:classpath:org/mybatis/spring/boot/autoconfigure/repository/CityMapper.xml");
TestPropertyValues.of(
"mybatis.config-location:mybatis-config-settings-only.xml",
"mybatis.type-aliases-package:org.mybatis.spring.boot.autoconfigure.domain",
"mybatis.mapper-locations:classpath:org/mybatis/spring/boot/autoconfigure/repository/CityMapper.xml")
.applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisBootMapperScanAutoConfiguration.class);
this.context.refresh();
Expand All @@ -318,14 +319,13 @@ public void testMixedWithConfigurationFileAndTypeAliasesPackageAndMapperLocation

@Test
public void testMixedWithFullConfigurations() {
EnvironmentTestUtils
.addEnvironment(
this.context,
"mybatis.config-location:mybatis-config-settings-only.xml",
"mybatis.type-handlers-package:org.mybatis.spring.boot.autoconfigure.handler",
"mybatis.type-aliases-package:org.mybatis.spring.boot.autoconfigure.domain",
"mybatis.mapper-locations:classpath:org/mybatis/spring/boot/autoconfigure/repository/CityMapper.xml",
"mybatis.executor-type=REUSE");
TestPropertyValues.of(
"mybatis.config-location:mybatis-config-settings-only.xml",
"mybatis.type-handlers-package:org.mybatis.spring.boot.autoconfigure.handler",
"mybatis.type-aliases-package:org.mybatis.spring.boot.autoconfigure.domain",
"mybatis.mapper-locations:classpath:org/mybatis/spring/boot/autoconfigure/repository/CityMapper.xml",
"mybatis.executor-type=REUSE")
.applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisBootMapperScanAutoConfiguration.class,
MybatisInterceptorConfiguration.class,
Expand All @@ -352,8 +352,9 @@ public void testMixedWithFullConfigurations() {

@Test
public void testWithMyBatisConfiguration() {
EnvironmentTestUtils.addEnvironment(this.context,
"mybatis.configuration.map-underscore-to-camel-case:true");
TestPropertyValues.of(
"mybatis.configuration.map-underscore-to-camel-case:true")
.applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisAutoConfiguration.class);
this.context.refresh();
Expand All @@ -362,8 +363,9 @@ public void testWithMyBatisConfiguration() {

@Test
public void testWithMyBatisConfigurationCustomizeByJavaConfig() {
EnvironmentTestUtils.addEnvironment(this.context,
"mybatis.configuration.default-fetch-size:100");
TestPropertyValues.of(
"mybatis.configuration.default-fetch-size:100")
.applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisAutoConfiguration.class,
MybatisPropertiesConfigurationCustomizer.class);
Expand All @@ -388,9 +390,10 @@ public void testWithMyBatisConfigurationCustomizer() {

@Test
public void testConfigFileAndConfigurationWithTogether() {
EnvironmentTestUtils.addEnvironment(this.context,
TestPropertyValues.of(
"mybatis.config-location:mybatis-config.xml",
"mybatis.configuration.default-statement-timeout:30");
"mybatis.configuration.default-statement-timeout:30")
.applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisAutoConfiguration.class);

Expand All @@ -404,7 +407,6 @@ public void testConfigFileAndConfigurationWithTogether() {

@Test
public void testWithoutConfigurationVariablesAndProperties() {
EnvironmentTestUtils.addEnvironment(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
Expand All @@ -416,8 +418,9 @@ public void testWithoutConfigurationVariablesAndProperties() {

@Test
public void testWithConfigurationVariablesOnly() {
EnvironmentTestUtils.addEnvironment(this.context,
"mybatis.configuration.variables.key1:value1");
TestPropertyValues.of(
"mybatis.configuration.variables.key1:value1")
.applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
Expand All @@ -430,8 +433,9 @@ public void testWithConfigurationVariablesOnly() {

@Test
public void testWithConfigurationPropertiesOnly() {
EnvironmentTestUtils.addEnvironment(this.context,
"mybatis.configuration-properties.key2:value2");
TestPropertyValues.of(
"mybatis.configuration-properties.key2:value2")
.applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
Expand All @@ -444,9 +448,10 @@ public void testWithConfigurationPropertiesOnly() {

@Test
public void testWithConfigurationVariablesAndPropertiesOtherKey() {
EnvironmentTestUtils.addEnvironment(this.context,
TestPropertyValues.of(
"mybatis.configuration.variables.key1:value1",
"mybatis.configuration-properties.key2:value2");
"mybatis.configuration-properties.key2:value2")
.applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
Expand All @@ -460,9 +465,10 @@ public void testWithConfigurationVariablesAndPropertiesOtherKey() {

@Test
public void testWithConfigurationVariablesAndPropertiesSameKey() {
EnvironmentTestUtils.addEnvironment(this.context,
TestPropertyValues.of(
"mybatis.configuration.variables.key:value1",
"mybatis.configuration-properties.key:value2");
"mybatis.configuration-properties.key:value2")
.applyTo(this.context);
this.context.register(EmbeddedDataSourceConfiguration.class,
MybatisAutoConfiguration.class,
PropertyPlaceholderAutoConfiguration.class);
Expand Down
21 changes: 20 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
<properties>
<mybatis.version>3.4.4</mybatis.version>
<mybatis-spring.version>1.3.1</mybatis-spring.version>
<spring-boot.version>1.5.6.RELEASE</spring-boot.version>
<spring-boot.version>2.0.0.M3</spring-boot.version>
</properties>

<dependencyManagement>
Expand Down Expand Up @@ -114,4 +114,23 @@
</dependencies>
</dependencyManagement>

<repositories>
<repository>
<id>spring-snapshots</id>
<name>Spring Snapshots</name>
<url>https://repo.spring.io/snapshot</url>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>spring-milestones</id>
<name>Spring Milestones</name>
<url>https://repo.spring.io/milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>

</project>

0 comments on commit 943e56f

Please sign in to comment.