Spring Boot Batch ResourcelessTransactionManager DataSourceProperties $ DataSourceBeanCreationException

Ich versuche, ein Spring-Boot-Batch-Projekt einzurichten, das ein @ verwendeResourcelessTransactionManager Transaktionsmanager mit Java-Konfiguration, aber ich habe kein Glück.

Der Grund, warum ich dies versuche, ist, dass ich nicht möchte, dass ein Zustand beibehalten wird, und ich würde es vorziehen, keinen Speicher mit hsqldb zu verschwenden, wenn ich nicht möchte, dass er anfängt. Ich habe ein vorhandenes Spring Batch-Projekt, das Spring Boot nicht verwendet, und es funktioniert ohne Dauerhaftigkeit und ohne hsqldb.

Ich benutze diesebeispielprojekt als Basis (aber ohne hsqldb) und diesesweitere Antwort als Referenz, aber ich bekomme immer diese Ausnahme:

Caused by: org.springframework.boot.autoconfigure.jdbc.DataSourceProperties$DataSourceBeanCreationException: Cannot determine embedded database driver class for database type NONE. If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).
    at org.springframework.boot.autoconfigure.jdbc.DataSourceProperties.determineDriverClassName(DataSourceProperties.java:218) ~[spring-boot-autoconfigure-1.4.0.RELEASE.jar:1.4.0.RELEASE]
    at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration.createDataSource(DataSourceConfiguration.java:42) ~[spring-boot-autoconfigure-1.4.0.RELEASE.jar:1.4.0.RELEASE]
    at org.springframework.boot.autoconfigure.jdbc.DataSourceConfiguration$Tomcat.dataSource(DataSourceConfiguration.java:55) ~[spring-boot-autoconfigure-1.4.0.RELEASE.jar:1.4.0.RELEASE]
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_73]
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_73]
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) ~[na:1.8.0_73]
    at java.lang.reflect.Method.invoke(Unknown Source) ~[na:1.8.0_73]
    at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:162) ~[spring-beans-4.3.2.RELEASE.jar:4.3.2.RELEASE]
    ... 56 common frames omitted

Das habe ich geändert:

@SpringBootApplication
@EnableBatchProcessing
@Configuration
public class SampleBatchApplication {

    @Autowired
    private JobBuilderFactory jobs;

    @Autowired
    private StepBuilderFactory steps;

    @Bean
    protected Tasklet tasklet() {

        return new Tasklet() {
            @Override
            public RepeatStatus execute(StepContribution contribution,
                    ChunkContext context) {
                return RepeatStatus.FINISHED;
            }
        };

    }

    @Bean
    public Job job() throws Exception {
        return this.jobs.get("job").start(step1()).build();
    }

    @Bean
    protected Step step1() throws Exception {
        return this.steps.get("step1").tasklet(tasklet()).build();
    }


    public static void main(String[] args) throws Exception {
        // System.exit is common for Batch applications since the exit code can be used to
        // drive a workflow
        System.exit(SpringApplication
                .exit(SpringApplication.run(SampleBatchApplication.class, args)));
    }

    @Bean
    ResourcelessTransactionManager transactionManager() {
        return new ResourcelessTransactionManager();
    }

    @Bean
    public JobRepository getJobRepo() throws Exception {
        return new MapJobRepositoryFactoryBean(transactionManager()).getObject();
    }

}

Was muss ich tun, damit es das @ verwendeResourcelessTransactionManager?

EDIT: Klarstellung hinzugefügt, warum der ResourcelessTransactionManager funktionieren soll.

Antworten auf die Frage(4)

Ihre Antwort auf die Frage