Я обновлял свою версию Spring boot 1.5.9 до версии 2.2.5, и я использовал BatchDataInitiliazer
, а затем я изменил на BatchDataSourceInitializer
, и кажется, что работает так же, но теперь я получаю это сообщение ошибки.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'batchConfig': Invocation of init method failed; nested exception is org.springframework.batch.core.configuration.BatchConfigurationException: org.springframework.jdbc.support.MetaDataAccessException: Could not get Connection for extracting meta-data; nested exception is org.springframework.jdbc.CannotGetJdbcConnectionException: Failed to obtain JDBC Connection: 'url' not set
это мои BatchConfiguration.java
и мои application.properties
@Bean
public JobLauncher asyncJobLauncher() throws Exception
{
SimpleJobLauncher jobLauncher = new SimpleJobLauncher();
jobLauncher.setJobRepository(jobRepository);
jobLauncher.afterPropertiesSet();
return jobLauncher;
}
@Bean
public BatchDataSourceInitializer batchDatabaseInitializer(DataSource dataSource, ResourceLoader resourceLoader)
{
BatchProperties batchProperties = new BatchProperties();
batchProperties.setSchema("classpath:schema.sql");
BatchDataSourceInitializer batchDatabaseInitializer = new BatchDataSourceInitializer(dataSource, resourceLoader, batchProperties);
return batchDatabaseInitializer;
}
мои application.properties
kieserver.url=http://localhost:8888/kieserver/services/rest/server
kieserver.username=kieserver
kieserver.password=k41r0s!
kieserver.container=maquinacalculo
kieserver.maquinacalculo.identificadorFatosProcessados=fatosProcessados
kieserver.maquinacalculo.arquivoComandosBase=droolsCommandsBase.xml
spring.kafka.consumer.group-id=kafka-calculo
spring.kafka.bootstrap-servers=localhost:9092
topic.json=maquinacalculo
redis.hostname=localhost
redis.port=6379
banner.location=banner.txt
spring.batch.job.enabled=false
spring.batch.initializer.enabled=false
spring.h2.console.enabled=true
spring.h2.console.path=/h2-console
#spring.datasource.type: com.zaxxer.hikari.HikariDataSource
#spring.datasource.hikari.jdbc-url: jdbc:sqlserver://localhost:lol;
#spring.datasource.hikari.driver-class-name: com.microsoft.sqlserver.jdbc.SQLServerDriver
#spring.datasource.hikari.username: user
#spring.datasource.hikari.password: password
#spring.datasource.hikari.maximum-pool-size: 30
#spring.datasource.initialize=false
batch.datasource.hikari.jdbc-url=jdbc:h2:file:~/maquinacalculodb;
batch.datasource.hikari.table.prefix=BATCH_
batch.datasource.hikari.driver-class-name=org.h2.Driver
batch.datasource.hikari.username=sa
batch.datasource.hikari.password=
batch.datasource.hikari.initialize=false
maquinacalculo.batch.job.chunkSize=1
maquinacalculo.batch.job.gridSize=20
maquinacalculo.batch.job.nomeFilaResultados=filaResultados