Class SpringBootBatchCommandLine
- java.lang.Object
-
- com.devonfw.module.batch.common.base.SpringBootBatchCommandLine
-
@Deprecated public class SpringBootBatchCommandLine extends Object
Deprecated.Since spring batch and spring boot are nicely integrated it is possible to start batches without any custom launcher. This is documented in the current devonfw batch documentation. This launcher is no longer required and will be removed in one of the next releases.Launcher for launching batch jobs from the command line when Spring Boot is used. It is somewhat similar to theCommandLineJobRunner
. The main difference is, that this launcher disables the web-app for the spring context. It expects the full class name of the Spring Boot configuration class to be used as first argument and the jobs beanname as the second.
Moreover parameters can be specified as further arguments (convention: key1=value1 key2=value2 ...).Example:
java -jar my-app-batch-bootified.jar com.devonfw.application.example.SpringBootApp myJob param=value...
For stopping all running executions of a job, use the -stop option. Example:
java -jar my-app-batch-bootified.jar com.devonfw.application.example.SpringBootApp myJob -stop
To make that work expect that the batchs is deployed in form of a "bootified" jar, whith this class here als the start-class. For that you have to add the following snipped to your pom.xml:
<build> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-jar-plugin</artifactId> <configuration> <excludes> <exclude>config/application.properties</exclude> </excludes> </configuration> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <configuration> <mainClass>com.devonfw.module.batch.common.base.SpringBootBatchCommandLine</mainClass> <classifier>bootified</classifier> </configuration> <executions> <execution> <goals> <goal>repackage</goal> </goals> </execution> </executions> </plugin> </plugins> </build>
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
SpringBootBatchCommandLine.Operation
Deprecated.Available operations
-
Constructor Summary
Constructors Constructor Description SpringBootBatchCommandLine()
Deprecated.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description void
execute(SpringBootBatchCommandLine.Operation operation, String configuration, String jobName, List<String> parameters)
Deprecated.Initialize the application context and execute the operation.protected int
getReturnCode(org.springframework.batch.core.JobExecution jobExecution)
Deprecated.static void
main(String[] args)
Deprecated.
-
-
-
Method Detail
-
main
public static void main(String[] args) throws Exception
Deprecated.- Parameters:
args
- the command-line arguments.- Throws:
Exception
- in case of an error.
-
getReturnCode
protected int getReturnCode(org.springframework.batch.core.JobExecution jobExecution)
Deprecated.- Parameters:
jobExecution
- theJobExecution
.- Returns:
- the corresponding
exit code
.
-
execute
public void execute(SpringBootBatchCommandLine.Operation operation, String configuration, String jobName, List<String> parameters) throws Exception
Deprecated.Initialize the application context and execute the operation.The application context is closed after the operation has finished.
- Parameters:
operation
- The operation to start.configuration
- The sources of app context configuration.jobName
- The name of the job to launch/stop.parameters
- The parameters (key=value).- Throws:
Exception
- in case of an error.
-
-