Spring Boot:-
Spring boot provide the control to create standalone java
application that can be started java-jar or more traditional war deployments.
Please refer below link for detail:-
Code Snippet:-
package com.test.service;
import org.springframework.boot.SpringApplication;
import
org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Configuration;
@SpringBootApplication
@Configuration
public class TestServiceApplication {
public static
void main(String[] args) {
SpringApplication.run(TestServiceApplication.class,
args);
}
}
package
com.test.service.interaction;
import java.util.Map;
import javax.ws.rs.GET;
import
javax.ws.rs.Produces;
import
javax.ws.rs.core.MediaType;
import
javax.ws.rs.core.Response;
import
org.springframework.web.bind.annotation.RequestBody;
import
org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
@RequestMapping("/service")
public class TestService {
@RequestMapping("/getTest")
@GET
@Produces(MediaType.APPLICATION_JSON)
public Response getTest(@RequestBody
Map<String,String> request) throws Exception{
System.out.println("TestService
:: Request Body is "+request);
return null;
}
}
No comments:
Post a Comment