How to create a task in spring -xd only using java config

Is there any example of using spring xd with pure java configuration (without xml). I created a simple tasklet, the same jarred (whojob.jar) and put it in the lib folder. The following is the xml configuration. I put this in a file called whojob, which is in the modules / job folder, and also jarred with my whojob.jar. When I try to create a job: - (:> job create --name mywhojob --definition "whojob") I get an error message: Reason: org.springframework.beans.factory.BeanCreationException: error creating bean named 'org. springframework.integration.config.TransformerFactoryBean # 0 ': cannot create internal bean' org.springframework.xd.dirt.plugins.job.JobLaunchRequestTransformer # 0 'of type [org.springframework.xd.dirt.plugins.job.JobLaformerRequest when setting the bean targetObject property;The nested exception is org.springframework.beans.factory.BeanCreationException: an error occurred while creating a bean named 'org.springframework.xd.dirt.plugins.job.JobLaunchRequestTransformer # 0' defined in the path resource of the [META-INF / spring - xd / plugins / job / job-module-beans.xml]: Unable to resolve the reference to the bean 'jobFactoryBean' when configuring the constructor argument; The nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean named "jobFactoryBean": FactoryBean threw an exception to create the object; The nested exception is java.lang.IllegalStateException: No Batch Job was found in the registry for the provided key 'mywhojob.job'. Below is my xml configuration. If possible, I would like to have a pure Java solution. Thanksspringframework.beans.factory.BeanCreationException: an error occurred while creating a bean named 'org.springframework.xd.dirt.plugins.job.JobLaunchRequestTransformer # 0' defined in the resource of the path to the course [META-INF / spring -xd / plugins / job / job-module- beans.xml]: cannot resolve the reference to bean 'jobFactoryBean' when configuring the constructor argument; The nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean named "jobFactoryBean": FactoryBean threw an exception to create the object; The nested exception is java.lang.IllegalStateException: No Batch Job was found in the registry for the provided key 'mywhojob.job'. Below is my xml configuration. If possible, I would like to have a pure Java solution. Thanksspringframework.beans.factory.BeanCreationException: an error occurred while creating a bean named 'org.springframework.xd.dirt.plugins.job.JobLaunchRequestTransformer # 0' defined in the resource of the path to the course [META-INF / spring -xd / plugins / job / job-module- beans.xml]: cannot resolve the reference to bean 'jobFactoryBean' when configuring the constructor argument; The nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean named "jobFactoryBean": FactoryBean threw an exception to create the object; The nested exception is java.lang.IllegalStateException: No Batch Job was found in the registry for the provided key 'mywhojob.job'. Below is my xml configuration. If possible, I would like to have a pure Java solution. Thanksan error occurred while creating a bean named 'org.springframework.xd.dirt.plugins.job.JobLaunchRequestTransformer # 0' defined in the resource of the path to the course [META-INF / spring -xd / plugins / job / job-module-beans.xml ]: cannot resolve the reference to bean 'jobFactoryBean' when setting constructor argument; The nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean named "jobFactoryBean": FactoryBean threw an exception to create the object; The nested exception is java.lang.IllegalStateException: No Batch Job was found in the registry for the provided key 'mywhojob.job'. Below is my xml configuration. If possible, I would like to have a pure Java solution. Thanksan error occurred while creating a bean named 'org.springframework.xd.dirt.plugins.job.JobLaunchRequestTransformer # 0' defined in the resource of the path to the course [META-INF / spring -xd / plugins / job / job-module-beans.xml ]: cannot resolve the reference to bean 'jobFactoryBean' when setting constructor argument; The nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean named "jobFactoryBean": FactoryBean threw an exception to create the object; The nested exception is java.lang.IllegalStateException: No Batch Job was found in the registry for the provided key 'mywhojob.job'. Below is my xml configuration. If possible, I would like to have a pure Java solution. Thanksdefined in the resource of the path to the course [META-INF / spring -xd / plugins / job / job-module-beans.xml]: the link to the bean 'jobFactoryBean' cannot be resolved when setting the constructor argument; The nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean named "jobFactoryBean": FactoryBean threw an exception to create the object; The nested exception is java.lang.IllegalStateException: No Batch Job was found in the registry for the provided key 'mywhojob.job'. Below is my xml configuration. If possible, I would like to have a pure Java solution. Thanksdefined in the resource of the path to the course [META-INF / spring -xd / plugins / job / job-module-beans.xml]: the link to the bean 'jobFactoryBean' cannot be resolved when setting the constructor argument; The nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean named "jobFactoryBean": FactoryBean threw an exception to create the object; The nested exception is java.lang.IllegalStateException: No Batch Job was found in the registry for the provided key 'mywhojob.job'. Below is my xml configuration. If possible, I would like to have a pure Java solution. ThanksBeanCreationException: Error creating bean named "jobFactoryBean": FactoryBean threw an exception to create the object; The nested exception is java.lang.IllegalStateException: No Batch Job was found in the registry for the provided key 'mywhojob.job'. Below is my xml configuration. If possible, I would like to have a pure Java solution. ThanksBeanCreationException: Error creating bean named "jobFactoryBean": FactoryBean threw an exception to create the object; The nested exception is java.lang.IllegalStateException: No Batch Job was found in the registry for the provided key 'mywhojob.job'. Below is my xml configuration. If possible, I would like to have a pure Java solution. Thanks

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:int="http://www.springframework.org/schema/integration"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"   
    xmlns:batch="http://www.springframework.org/schema/batch"
xsi:schemaLocation="http://www.springframework.org/schema/beans
    http://www.springframework.org/schema/beans/spring-beans.xsd
    http://www.springframework.org/schema/integration
    http://www.springframework.org/schema/integration/spring-integration.xsd
    http://www.springframework.org/schema/batch
    http://www.springframework.org/schema/batch/spring-batch.xsd">

<batch:job id="whojob">
    <batch:step id="whojobStep">
        <batch:tasklet ref="whojobXDTasklet" />
    </batch:step>
</batch:job>

<bean id="whojobXDTasklet"
    class=" com.auction.data.batch.job.WhoTasklet" >
    <property name= "who" ref="whoBean"/> 
</bean>

<bean id="whoBean"
    class="com.auction.data.batch.service.Who" >

</bean>

    </beans>
+4
1

, XD- , jar.

https://github.com/ilayaperumalg/spring-xd-batch-sample

jar repo, :./gradlew build

, "myjob" ( ). "myjob" $XD_HOME/modules/job/.

XD M6 , - .

+1

Source: https://habr.com/ru/post/1530500/


All Articles