Spark
Very simple to use
public static void main(String...args) {
get("/umPath", (req, res) -> {
//Regra de negocio
return "resultado"
});
}
SpringBoot
Also very simple, but different from spark, a controller should be created and annotated with @RestController
@ResController
@EnableAutoConfiguration
public class UmaClasseController {
@RequestMapping("/umPath")
@ResponseBody
String ola() {
//Regra de negocio
return "Resultado";
}
public static void main(String[] args) throws Exception {
SpringApplication.run(UmaClasseController.class, args);
}
}
The good thing about Spring is that if you put the return type as an object or an object collection it already serializes to JSON.
Jersey
It's also good, but requires some configuration, and can be used in conjunction with SpringBoot, annotated with @Component.