Answer the question
In order to leave comments, you need to log in
How to properly configure a spring cloud application?
I can't configure spring batch application to run it in spring data flow. I've been fighting for two days now and everything is somehow very difficult.
The task is to read csv and write it to one plate. I configured the reader and writer, everything is simple here and it seems to work falsely. But all parsley, in spring batch and spring cloud task. They really need their own database in order to write down their control data TASK and JOB tables there. And all this greatly complicates the configuration of the application. To test locally, I created the following config
@Slf4j
@Configuration
@Profile("!cloud")
public class LocalConfiguration {
@Bean
public BatchConfigurer batchConfigurer(DataSource dataSource) {
log.info("create local BatchConfigurer");
return new DefaultBatchConfigurer(dataSource) {
@Override
public void setDataSource(DataSource dataSource) {
log.info("called setDataSource");
}
};
}
@Bean
public TaskConfigurer taskConfigurerLocal() {
return new DefaultTaskConfigurer((DataSource) null);
}
}
@Bean
public ItemWriter<ZgsEntity> writerProduction() {
log.info("create writer");
return new RepositoryItemWriter<ZgsEntity>() {{
setRepository(zgsRepository);
}};
}
2021-08-19 15:38:42.808 [main] TRACE o.h.engine.spi.IdentifierValue - ID unsaved-value strategy UNDEFINED
2021-08-19 15:38:42.808 [main] TRACE o.h.event.internal.EntityState - Transient instance of: com.daimler.zgs.entities.ZgsEntity
2021-08-19 15:38:42.808 [main] TRACE o.h.e.i.DefaultPersistEventListener - Saving transient instance
2021-08-19 15:38:42.808 [main] DEBUG o.h.e.i.AbstractSaveEventListener - Generated identifier: component[вырезал}, using strategy: org.hibernate.id.CompositeNestedGeneratedValueGenerator
2021-08-19 15:38:42.808 [main] TRACE o.h.e.i.AbstractSaveEventListener - Saving [com.daimler.zgs.entities.ZgsEntity#component[вырезал]{вырезал}]
2021-08-19 15:38:42.808 [main] TRACE org.hibernate.engine.spi.ActionQueue - Adding an EntityInsertAction for [com.daimler.zgs.entities.ZgsEntity] object
2021-08-19 15:38:42.808 [main] TRACE org.hibernate.engine.spi.ActionQueue - Adding insert with no non-nullable, transient entities: [EntityInsertAction[com.daimler.zgs.entities.ZgsEntity#[email protected]]]
2021-08-19 15:38:42.808 [main] TRACE org.hibernate.engine.spi.ActionQueue - Adding resolved non-early insert action.
2021-08-19 15:38:42.810 [main] TRACE org.hibernate.internal.SessionImpl - Closing session [0eb1b3ba-2fb0-4187-a618-0eb24fb56e8b]
2021-08-19 15:38:42.810 [main] TRACE o.h.e.j.internal.JdbcCoordinatorImpl - Closing JDBC container
2021-08-19 15:38:42.810 [main] TRACE o.h.r.j.i.ResourceRegistryStandardImpl - Releasing JDBC resources
2021-08-19 15:38:42.810 [main] TRACE o.h.r.j.i.LogicalConnectionManagedImpl - Closing logical connection
2021-08-19 15:38:42.810 [main] TRACE o.h.r.j.i.LogicalConnectionManagedImpl - Logical connection closed
2021-08-19 15:38:42.811 [main] INFO o.s.batch.core.step.AbstractStep - Step: [step1] executed in 48ms
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question