This package can check SQL syntax in Mapper.xml
files by invoking all Mapper
methods with dummy args.
Maven dependency: io.github.uqix/sql-checker
import io.github.uqix.sqlchecker.SqlChecker;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;
import org.springframework.context.annotation.Profile;
import org.springframework.transaction.PlatformTransactionManager;
@Configuration
class SqlCheckerConfig {
@Bean
// @DependsOn("liquibase")
// or
// @DependsOn("flyway")
@Profile("sql_check")
public SqlChecker sqlChecker(ApplicationContext context, PlatformTransactionManager txManager) {
return new SqlChecker(context, txManager);
}
}
You can ignore a Mapper method by annotate it with @DisableSqlChecker
.