-
Notifications
You must be signed in to change notification settings - Fork 675
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
Conversation
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! |
Hi @bog-walk |
There was a problem hiding this 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.
c8b6b85
to
920a671
Compare
All done @bog-walk |
@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. |
@rbraeunlich Please |
All done @bog-walk |
buildSrc/src/main/kotlin/org/jetbrains/exposed/gradle/Versions.kt
Outdated
Show resolved
Hide resolved
Thanks for all your help with this PR @rbraeunlich ! |
@rbraeunlich, thanks for the PR! LGTM |
…1636) (JetBrains#1645) Co-authored-by: Ronny Bräunlich <ronny.braeunlich@cbc.de>
Some documentation for reference:
ApplicationContextRunner
(Spring Boot Reference)