spring-batch icon indicating copy to clipboard operation
spring-batch copied to clipboard

Add static variables to prevent typos in the metadata tables string path

Open spring0913 opened this issue 1 year ago • 1 comments

From the #4252, I realized that I had to use addScript to create the metadata table when using an In-memory database in Spring Boot 3.0 / Spring Batch 5.0.

I think it is better to use static variables to prevent typos in the metadata table creation script path string.

After I create PR about this(schema-h2), if it is approved, I would like to add static variables to the other databases as well.

AS-IS

@Bean
public DataSource dataSource() {
    return new EmbeddedDatabaseBuilder()
		.addScript("/org/springframework/batch/core/schema-h2.sql")
		.build();
}

TO-BE

@Bean
public DataSource dataSource() {
    return new EmbeddedDatabaseBuilder()
		.addScript(DatabaseResource.SCHEMA_H2)
		.build();
}

spring0913 avatar May 05 '24 13:05 spring0913