From c38465f630268e67a85e0ace2aa2e3a274dc6f39 Mon Sep 17 00:00:00 2001 From: Kazuki Shimizu Date: Sun, 3 Aug 2025 15:43:29 +0900 Subject: [PATCH 1/2] Apply Spring Boot 4.0.0-SNAPSHOT --- mybatis-spring-boot-autoconfigure/pom.xml | 17 ++++++++--------- .../autoconfigure/MybatisAutoConfiguration.java | 2 +- .../MybatisAutoConfigurationTest.java | 10 +++++----- .../autoconfigure/MybatisPropertiesTest.java | 4 ++-- .../mybatis/kotlin/SampleKotlinApplication.kt | 4 ++-- .../mybatis-spring-boot-sample-war/pom.xml | 6 ++++++ .../war/SampleMybatisApplicationTest.java | 4 ++-- .../mybatis-spring-boot-sample-web/pom.xml | 5 +++++ .../web/SampleMybatisApplicationTest.java | 4 ++-- ...ampleMybatisWithMockBeanApplicationTest.java | 8 ++++---- mybatis-spring-boot-test-autoconfigure/pom.xml | 5 +++++ ...t.autoconfigure.AutoConfigureMybatis.imports | 16 +++++++++------- pom.xml | 2 +- 13 files changed, 52 insertions(+), 35 deletions(-) diff --git a/mybatis-spring-boot-autoconfigure/pom.xml b/mybatis-spring-boot-autoconfigure/pom.xml index c146327e..9df570a8 100644 --- a/mybatis-spring-boot-autoconfigure/pom.xml +++ b/mybatis-spring-boot-autoconfigure/pom.xml @@ -47,6 +47,10 @@ org.springframework.boot spring-boot-autoconfigure + + org.springframework.boot + spring-boot-jdbc + @@ -99,24 +103,19 @@ h2 test - - org.springframework.boot - spring-boot-starter-jdbc - test - org.springframework.boot spring-boot-starter-test test - org.flywaydb - flyway-core + org.springframework.boot + spring-boot-starter-flyway test - org.liquibase - liquibase-core + org.springframework.boot + spring-boot-starter-liquibase test diff --git a/mybatis-spring-boot-autoconfigure/src/main/java/org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.java b/mybatis-spring-boot-autoconfigure/src/main/java/org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.java index 5da820fa..21c8410e 100644 --- a/mybatis-spring-boot-autoconfigure/src/main/java/org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.java +++ b/mybatis-spring-boot-autoconfigure/src/main/java/org/mybatis/spring/boot/autoconfigure/MybatisAutoConfiguration.java @@ -54,8 +54,8 @@ import org.springframework.boot.autoconfigure.condition.ConditionalOnClass; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.boot.autoconfigure.condition.ConditionalOnSingleCandidate; -import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration; import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration; import org.springframework.context.EnvironmentAware; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Import; diff --git a/mybatis-spring-boot-autoconfigure/src/test/java/org/mybatis/spring/boot/autoconfigure/MybatisAutoConfigurationTest.java b/mybatis-spring-boot-autoconfigure/src/test/java/org/mybatis/spring/boot/autoconfigure/MybatisAutoConfigurationTest.java index 77a8e413..c8040599 100644 --- a/mybatis-spring-boot-autoconfigure/src/test/java/org/mybatis/spring/boot/autoconfigure/MybatisAutoConfigurationTest.java +++ b/mybatis-spring-boot-autoconfigure/src/test/java/org/mybatis/spring/boot/autoconfigure/MybatisAutoConfigurationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -76,10 +76,10 @@ import org.springframework.beans.factory.config.RuntimeBeanReference; import org.springframework.boot.autoconfigure.AutoConfigurations; import org.springframework.boot.autoconfigure.context.PropertyPlaceholderAutoConfiguration; -import org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration; -import org.springframework.boot.autoconfigure.flyway.FlywayMigrationInitializer; -import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration; -import org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration; +import org.springframework.boot.flyway.autoconfigure.FlywayAutoConfiguration; +import org.springframework.boot.flyway.autoconfigure.FlywayMigrationInitializer; +import org.springframework.boot.jdbc.autoconfigure.EmbeddedDataSourceConfiguration; +import org.springframework.boot.liquibase.autoconfigure.LiquibaseAutoConfiguration; import org.springframework.boot.test.context.runner.ApplicationContextRunner; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; diff --git a/mybatis-spring-boot-autoconfigure/src/test/java/org/mybatis/spring/boot/autoconfigure/MybatisPropertiesTest.java b/mybatis-spring-boot-autoconfigure/src/test/java/org/mybatis/spring/boot/autoconfigure/MybatisPropertiesTest.java index 4edcc951..1f11821a 100644 --- a/mybatis-spring-boot-autoconfigure/src/test/java/org/mybatis/spring/boot/autoconfigure/MybatisPropertiesTest.java +++ b/mybatis-spring-boot-autoconfigure/src/test/java/org/mybatis/spring/boot/autoconfigure/MybatisPropertiesTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2024 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,7 +38,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.PropertyAccessorFactory; import org.springframework.boot.autoconfigure.AutoConfigurations; -import org.springframework.boot.autoconfigure.jdbc.EmbeddedDataSourceConfiguration; +import org.springframework.boot.jdbc.autoconfigure.EmbeddedDataSourceConfiguration; import org.springframework.boot.test.context.runner.ApplicationContextRunner; /** diff --git a/mybatis-spring-boot-samples/mybatis-spring-boot-sample-kotlin/src/main/kotlin/sample/mybatis/kotlin/SampleKotlinApplication.kt b/mybatis-spring-boot-samples/mybatis-spring-boot-sample-kotlin/src/main/kotlin/sample/mybatis/kotlin/SampleKotlinApplication.kt index c6327efe..b0dd58ad 100644 --- a/mybatis-spring-boot-samples/mybatis-spring-boot-sample-kotlin/src/main/kotlin/sample/mybatis/kotlin/SampleKotlinApplication.kt +++ b/mybatis-spring-boot-samples/mybatis-spring-boot-sample-kotlin/src/main/kotlin/sample/mybatis/kotlin/SampleKotlinApplication.kt @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -25,7 +25,7 @@ import sample.mybatis.kotlin.mapper.CityMapper class SampleKotlinApplication (private val cityMapper: CityMapper) : CommandLineRunner { @Transactional - override fun run(vararg args: String?) { + override fun run(vararg args: String) { println(this.cityMapper.findByState("CA")) } diff --git a/mybatis-spring-boot-samples/mybatis-spring-boot-sample-war/pom.xml b/mybatis-spring-boot-samples/mybatis-spring-boot-sample-war/pom.xml index 904e7b62..e9f013d5 100644 --- a/mybatis-spring-boot-samples/mybatis-spring-boot-sample-war/pom.xml +++ b/mybatis-spring-boot-samples/mybatis-spring-boot-sample-war/pom.xml @@ -29,6 +29,7 @@ 11 11.0.9 + true org.mybatis.spring.boot.sample.war @@ -68,6 +69,11 @@ runtime + + org.springframework.boot + spring-boot-starter-restclient + test + org.springframework.boot spring-boot-starter-test diff --git a/mybatis-spring-boot-samples/mybatis-spring-boot-sample-war/src/test/java/sample/mybatis/war/SampleMybatisApplicationTest.java b/mybatis-spring-boot-samples/mybatis-spring-boot-sample-war/src/test/java/sample/mybatis/war/SampleMybatisApplicationTest.java index 18f6f780..c8498ffb 100644 --- a/mybatis-spring-boot-samples/mybatis-spring-boot-sample-war/src/test/java/sample/mybatis/war/SampleMybatisApplicationTest.java +++ b/mybatis-spring-boot-samples/mybatis-spring-boot-sample-war/src/test/java/sample/mybatis/war/SampleMybatisApplicationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.test.client.TestRestTemplate; /** * @author Kazuki Shimizu diff --git a/mybatis-spring-boot-samples/mybatis-spring-boot-sample-web/pom.xml b/mybatis-spring-boot-samples/mybatis-spring-boot-sample-web/pom.xml index 63d88488..b67654f3 100644 --- a/mybatis-spring-boot-samples/mybatis-spring-boot-sample-web/pom.xml +++ b/mybatis-spring-boot-samples/mybatis-spring-boot-sample-web/pom.xml @@ -44,6 +44,11 @@ runtime + + org.springframework.boot + spring-boot-starter-restclient + test + org.springframework.boot spring-boot-starter-test diff --git a/mybatis-spring-boot-samples/mybatis-spring-boot-sample-web/src/test/java/sample/mybatis/web/SampleMybatisApplicationTest.java b/mybatis-spring-boot-samples/mybatis-spring-boot-sample-web/src/test/java/sample/mybatis/web/SampleMybatisApplicationTest.java index 4a0886e1..80428999 100644 --- a/mybatis-spring-boot-samples/mybatis-spring-boot-sample-web/src/test/java/sample/mybatis/web/SampleMybatisApplicationTest.java +++ b/mybatis-spring-boot-samples/mybatis-spring-boot-sample-web/src/test/java/sample/mybatis/web/SampleMybatisApplicationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2022 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -22,7 +22,7 @@ import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.test.client.TestRestTemplate; /** * @author Kazuki Shimizu diff --git a/mybatis-spring-boot-samples/mybatis-spring-boot-sample-web/src/test/java/sample/mybatis/web/SampleMybatisWithMockBeanApplicationTest.java b/mybatis-spring-boot-samples/mybatis-spring-boot-sample-web/src/test/java/sample/mybatis/web/SampleMybatisWithMockBeanApplicationTest.java index ebc11694..220a7e8a 100644 --- a/mybatis-spring-boot-samples/mybatis-spring-boot-sample-web/src/test/java/sample/mybatis/web/SampleMybatisWithMockBeanApplicationTest.java +++ b/mybatis-spring-boot-samples/mybatis-spring-boot-sample-web/src/test/java/sample/mybatis/web/SampleMybatisWithMockBeanApplicationTest.java @@ -1,5 +1,5 @@ /* - * Copyright 2015-2023 the original author or authors. + * Copyright 2015-2025 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -24,8 +24,8 @@ import org.mockito.Mockito; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.boot.test.mock.mockito.MockBean; -import org.springframework.boot.test.web.client.TestRestTemplate; +import org.springframework.boot.web.server.test.client.TestRestTemplate; +import org.springframework.test.context.bean.override.mockito.MockitoBean; import sample.mybatis.web.domain.City; import sample.mybatis.web.mapper.CityMapper; @@ -39,7 +39,7 @@ class SampleMybatisWithMockBeanApplicationTest { @Autowired private TestRestTemplate restTemplate; - @MockBean + @MockitoBean CityMapper cityMapper; @BeforeEach diff --git a/mybatis-spring-boot-test-autoconfigure/pom.xml b/mybatis-spring-boot-test-autoconfigure/pom.xml index 310c8794..77b2b181 100644 --- a/mybatis-spring-boot-test-autoconfigure/pom.xml +++ b/mybatis-spring-boot-test-autoconfigure/pom.xml @@ -69,5 +69,10 @@ spring-boot-starter-test test + + org.springframework.boot + spring-boot-starter-cache + test + diff --git a/mybatis-spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.mybatis.spring.boot.test.autoconfigure.AutoConfigureMybatis.imports b/mybatis-spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.mybatis.spring.boot.test.autoconfigure.AutoConfigureMybatis.imports index ee48bc0c..441b4305 100644 --- a/mybatis-spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.mybatis.spring.boot.test.autoconfigure.AutoConfigureMybatis.imports +++ b/mybatis-spring-boot-test-autoconfigure/src/main/resources/META-INF/spring/org.mybatis.spring.boot.test.autoconfigure.AutoConfigureMybatis.imports @@ -1,10 +1,12 @@ # AutoConfigureMybatis auto-configuration imports -org.springframework.boot.autoconfigure.flyway.FlywayAutoConfiguration -org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration -org.springframework.boot.autoconfigure.jdbc.DataSourceTransactionManagerAutoConfiguration -org.springframework.boot.autoconfigure.jdbc.JdbcTemplateAutoConfiguration -org.springframework.boot.autoconfigure.liquibase.LiquibaseAutoConfiguration -org.springframework.boot.autoconfigure.transaction.TransactionAutoConfiguration -org.springframework.boot.autoconfigure.sql.init.SqlInitializationAutoConfiguration +org.springframework.boot.jdbc.autoconfigure.DataSourceAutoConfiguration +org.springframework.boot.jdbc.autoconfigure.DataSourceInitializationAutoConfiguration +org.springframework.boot.jdbc.autoconfigure.DataSourceTransactionManagerAutoConfiguration +org.springframework.boot.jdbc.autoconfigure.JdbcClientAutoConfiguration +org.springframework.boot.jdbc.autoconfigure.JdbcTemplateAutoConfiguration +org.springframework.boot.transaction.autoconfigure.TransactionAutoConfiguration org.mybatis.spring.boot.autoconfigure.MybatisLanguageDriverAutoConfiguration org.mybatis.spring.boot.autoconfigure.MybatisAutoConfiguration +optional:org.springframework.boot.flyway.autoconfigure.FlywayAutoConfiguration +optional:org.springframework.boot.liquibase.autoconfigure.LiquibaseAutoConfiguration +optional:org.springframework.boot.testcontainers.service.connection.ServiceConnectionAutoConfiguration diff --git a/pom.xml b/pom.xml index 8c840e9d..db239622 100644 --- a/pom.xml +++ b/pom.xml @@ -77,7 +77,7 @@ 1.3.0 2.3.0 1.1.0 - 3.5.4 + 4.0.0-SNAPSHOT --add-opens java.base/java.lang=ALL-UNNAMED -Dfile.encoding=UTF-8 From 2cd0562c04ec9613983e8e362bf2390f82616ca3 Mon Sep 17 00:00:00 2001 From: Kazuki Shimizu Date: Sun, 3 Aug 2025 16:00:14 +0900 Subject: [PATCH 2/2] Add -Denforcer.skip=true on GitHub Action's workflow --- .github/workflows/ci.yaml | 2 +- .github/workflows/coveralls.yaml | 4 ++-- .github/workflows/support.yaml | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 6df21c05..ec4af04c 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -26,4 +26,4 @@ jobs: distribution: ${{ matrix.distribution }} cache: ${{ matrix.cache }} - name: Test with Maven - run: ./mvnw test -B -V --no-transfer-progress -D"license.skip=true" + run: ./mvnw test -B -V --no-transfer-progress -D"license.skip=true" -D"enforcer.skip=true" diff --git a/.github/workflows/coveralls.yaml b/.github/workflows/coveralls.yaml index b4aaaa99..feeb039a 100644 --- a/.github/workflows/coveralls.yaml +++ b/.github/workflows/coveralls.yaml @@ -18,12 +18,12 @@ jobs: java-version: 21 - name: Report Coverage to Coveralls for Pull Requests if: github.event_name == 'pull_request' - run: ./mvnw -B -V test jacoco:report coveralls:report -q -Dlicense.skip=true -DrepoToken=$GITHUB_TOKEN -DserviceName=github -DpullRequest=$PR_NUMBER --no-transfer-progress + run: ./mvnw -B -V test jacoco:report coveralls:report -q -Dlicense.skip=true -Denforcer.skip=true -DrepoToken=$GITHUB_TOKEN -DserviceName=github -DpullRequest=$PR_NUMBER --no-transfer-progress env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} PR_NUMBER: ${{ github.event.number }} - name: Report Coverage to Coveralls for General Push if: github.event_name == 'push' - run: ./mvnw -B -V test jacoco:report coveralls:report -q -Dlicense.skip=true -DrepoToken=$GITHUB_TOKEN -DserviceName=github --no-transfer-progress + run: ./mvnw -B -V test jacoco:report coveralls:report -q -Dlicense.skip=true -Denforcer.skip=true -DrepoToken=$GITHUB_TOKEN -DserviceName=github --no-transfer-progress env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/support.yaml b/.github/workflows/support.yaml index 9e1690e9..1987a383 100644 --- a/.github/workflows/support.yaml +++ b/.github/workflows/support.yaml @@ -41,5 +41,5 @@ jobs: distribution: ${{ matrix.distribution }} - name: Test with Spring Boot Latest run: | - ./mvnw package + ./mvnw package -D"enforcer.skip=true" ./mybatis-spring-boot-samples/run_fatjars.sh