Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- server:
- port: ${port:9080}
- spring:
- datasource:
- data: schema-setup.sql
- driver-class-name: org.h2.Driver
- # name: datasource
- initialize: true
- sql-script-encoding: UTF-8
- url: jdbc:h2:mem:JavaSpringBootBatch;DB_CLOSE_DELAY=-1;DB_CLOSE_ON_EXIT=FALSE;MODE=MySQL;
- username: sa
- password:
- # schema: schema-setup.sql
- profiles: # default, development, production
- active: default, development
- ---
- spring:
- h2:
- console:
- enabled: true
- path: /h2-console
- profiles: development
- ---
- server:
- port: ${port:80}
- spring:
- datasource:
- # ...datasource config here
- profiles: production
- @Configuration
- public class PlayerBatchConfig {
- ...
- @Bean
- public ItemWriter<Player> writer(final DataSource dataSource) {
- final JdbcBatchItemWriter<Player> jdbcItemWriter = new JdbcBatchItemWriter<>();
- ...
- jdbcItemWriter.setDataSource(dataSource);
- jdbcItemWriter.setSql(sql.toString());
- return jdbcItemWriter;
- }
- }
- @Configuration
- public class PlayerBatchConfig {
- @Bean
- @ConfigurationProperties(prefix = "datasource")
- public DataSource dataSource() {
- return DataSourceBuilder.create().build();
- }
- ...
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement