Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: EXPOSED-171 Switch from spring.factories to AutoConfiguration.imports (#1636) #1645

Merged
merged 1 commit into from
Sep 21, 2023

Conversation

rbraeunlich
Copy link
Contributor

@rbraeunlich rbraeunlich commented Dec 5, 2022

Some documentation for reference:

@bog-walk
Copy link
Member

bog-walk commented Sep 7, 2023

Hi @rbraeunlich , I realize that this PR was opened a while go, but please let me know if you're available to work on it if I request some changes. Or if you're willing to have me checkout the branch and push changes directly.

Thanks in advance!

@rbraeunlich
Copy link
Contributor Author

Hi @bog-walk
whatever works best for you. I don't mind to apply any changes.

@bog-walk bog-walk self-assigned this Sep 8, 2023
Copy link
Member

@bog-walk bog-walk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please also update the following files:

buildSrc/.../Versions.kt

  • Bump springFramework to 6.0.11
  • Bump springBoot to 3.1.3

exposed-spring-boot-starter/build.gradle.kts

  • Bump H2 testImplementation to Versions.h2_v2

exposed-spring-boot-starter/test/.../ExposedAutoConfigurationTest.kt

  • Add the following test to the ExposedAutoConfigurationTest class:
@Test
fun testClassExcludedFromAutoConfig() {
    val contextRunner = ApplicationContextRunner().withConfiguration(
        AutoConfigurations.of(Application::class.java)
    )
    contextRunner.run { context ->
        assertThrows(NoSuchBeanDefinitionException::class.java) {
            context.getBean(DataSourceTransactionManagerAutoConfiguration::class.java)
        }
    }
}

exposed-spring-boot-starter/test/.../Application.kt

  • Change the annotation to have an exclude:
@SpringBootApplication(exclude = [DataSourceTransactionManagerAutoConfiguration::class])

Fyi, this exclude could also be done using @EnableAutoConfiguration on the test class CustomDatabaseConfigConfiguration or using a property in application.properties, so we should also update the README to cover the options.

README.md

  • In the 'Configuring Exposed' section, please change the custom config code block to look like this:
@Configuration
@EnableAutoConfiguration(exclude = [DataSourceTransactionManagerAutoConfiguration::class])
class ExposedConfig {
  @Bean
  fun databaseConfig() = DatabaseConfig {
    useNestedTransactions = true
  }
}
  • In the same section, under the code block above, please include all the following text:

It is recommended that the DataSourceTransactionManagerAutoConfiguration class be excluded from auto-configuration, which can be done in a custom configuration, as shown above.

Alternatively, the class can be disabled using the exclude attribute of @SpringBootApplication:

@SpringBootApplication(exclude = [DataSourceTransactionManagerAutoConfiguration::class])
class MyApplication

See the official documentation for more options to exclude auto-configuration classes.

@rbraeunlich
Copy link
Contributor Author

All done @bog-walk

@bog-walk bog-walk changed the title Switch from spring.factories to AutoConfiguration.imports (#1636) fix: EXPOSED-171 Switch from spring.factories to AutoConfiguration.imports (#1636) Sep 12, 2023
@bog-walk
Copy link
Member

@rbraeunlich Just to keep you updated:

We're working on our jvmToolchain. Once that PR is merged, I'll let you know and ask you to rebase so you can set the spring modules to use jdk17, which should fix the failed build. Shouldn't be long.

@bog-walk
Copy link
Member

@rbraeunlich Please rebase from main to get the recently merged jvmToolchain changes. Then set the jdk in both exposed-spring-boot-starter and spring-transaction modules from 8 to the required 17.

@rbraeunlich
Copy link
Contributor Author

All done @bog-walk

@bog-walk
Copy link
Member

Thanks for all your help with this PR @rbraeunlich !

@bog-walk bog-walk requested a review from e5l September 18, 2023 13:33
@e5l
Copy link
Member

e5l commented Sep 21, 2023

@rbraeunlich, thanks for the PR! LGTM

@bog-walk bog-walk merged commit fcf308a into JetBrains:main Sep 21, 2023
3 checks passed
saral pushed a commit to saral/Exposed that referenced this pull request Oct 3, 2023
…1636) (JetBrains#1645)

Co-authored-by: Ronny Bräunlich <ronny.braeunlich@cbc.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make it spring-boot 3 compatible exposed-spring-boot-starter does not work with spring-boot v3.0.0
4 participants