You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Where I work, we have several Spring Boot 3.x applications that use MyBatis through the mybatis-spring-boot-starter (3.0.2) dependency. We would like to “force” some MyBatis settings (like the defaultStatementTimeout) using our core library used by all applications so that each application does not need particular changes (even in the future).
Initially, I thought this task was possible using a custom auto-configuration and some kind of “customizer”. Indeed, I found there are two customizers: ConfigurationCustomizer and SqlSessionFactoryBeanCustomizer.
However, these customizations are not helpful for us. The configuration is not directly explicit in yaml configuration file since each application uses the config-location property, and thus, ConfigurationCustomizers are never fired (even if present). SqlSessionFactoryBeanCustomizers are fired, but the configuration is still null, so there is no easy/clean way to force some settings, as I said before.
I understand things are not currently this way, but I believe the firing of ConfigurationCustomizers is really misplaced. In theory, it should be done just before the line:
(see buildSqlSessionFactory() in SqlSessionFactoryBean)
Because, at that point, targetConfiguration is undoubtedly present as a) explicit configuration, b) loaded from XML, or c) defaulted from Configuration constructor.
P.S. I know and understand that currently, SqlSessionFactoryBean is in mybatis-spring while customizers are in mybatis-spring-boot-autoconfigure.
The text was updated successfully, but these errors were encountered:
Where I work, we have several Spring Boot 3.x applications that use MyBatis through the
mybatis-spring-boot-starter
(3.0.2) dependency. We would like to “force” some MyBatis settings (like thedefaultStatementTimeout
) using our core library used by all applications so that each application does not need particular changes (even in the future).Initially, I thought this task was possible using a custom auto-configuration and some kind of “customizer”. Indeed, I found there are two customizers:
ConfigurationCustomizer
andSqlSessionFactoryBeanCustomizer
.However, these customizations are not helpful for us. The configuration is not directly explicit in
yaml
configuration file since each application uses theconfig-location
property, and thus,ConfigurationCustomizer
s are never fired (even if present).SqlSessionFactoryBeanCustomizer
s are fired, but the configuration is still null, so there is no easy/clean way to force some settings, as I said before.I understand things are not currently this way, but I believe the firing of
ConfigurationCustomizer
s is really misplaced. In theory, it should be done just before the line:(see
buildSqlSessionFactory()
inSqlSessionFactoryBean
)Because, at that point,
targetConfiguration
is undoubtedly present as a) explicit configuration, b) loaded from XML, or c) defaulted fromConfiguration
constructor.P.S. I know and understand that currently,
SqlSessionFactoryBean
is inmybatis-spring
while customizers are inmybatis-spring-boot-autoconfigure
.The text was updated successfully, but these errors were encountered: