Infobip Spring Data Querydsl provides new functionality that enables the user to leverage the full power of Querydsl API on top of Spring Data repository infrastructure.
The current code for R2dbcSQLTemplatesConfiguration.
@ConditionalOnClass(Flyway.class)
@Configuration
public class R2dbcSQLTemplatesConfiguration {
@ConditionalOnBean(Flyway.class)
@Bean
public SQLTemplates sqlTemplates(Flyway flyway) throws SQLException {
var jdbcConnectionFactory = new JdbcConnectionFactory(flyway.getConfiguration().getDataSource(),
flyway.getConfiguration(),
null);
var sqlTemplatesRegistry = new SQLTemplatesRegistry();
var metaData = jdbcConnectionFactory.openConnection().getMetaData();
var templates = sqlTemplatesRegistry.getTemplates(metaData);
if (templates instanceof SQLServerTemplates || metaData.getDatabaseMajorVersion() > 11) {
return new SQLServer2012Templates();
}
return templates;
}
}
The condition of the if in your code is strange. The two conditions are an OR operation.
templates instanceof SQLServerTemplates
metaData.getDatabaseMajorVersion() > 11
With these conditions, the SQLServer2012Templates instance is registered as a bean when using Postgres 14.5.
In my opinion, the two conditions should be an AND operation.
please confirm this if condition code.
The current code for R2dbcSQLTemplatesConfiguration.
The condition of the
if
in your code is strange. The two conditions are an OR operation.templates instanceof SQLServerTemplates
metaData.getDatabaseMajorVersion() > 11
With these conditions, the
SQLServer2012Templates
instance is registered as a bean when using Postgres 14.5. In my opinion, the two conditions should be an AND operation. please confirm thisif
condition code.