Spring boot & batch — 1

Stride 1 — create a simple rest controller and validate the test method

We are going to create a spring boot batch application to read a csv file , manipulate some data and store it in my sql database using service/dao layers.

Step 1: Create a spring boot project using spring.io and load it in intellij.

Spring initializer project details and dependencies. — use gradel groovy

Step 2: First create a controller named BatchController .java under the package controller

controller package structure

Step 3: Make the controller as rest api using the annotation @Restcontroller . Add the below code to test the api.

package com.example.batchapplication.controller;

import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
public class BatchController {

@GetMapping("/test")
public String testApi(){
System.out.println("api testing is working fine");
return "I am a rest api ";
}

}

Step 4: Now test the api using talend rest api tester /local browser

url: localhost:8080/test

Ouput in talend rest client

--

--