Junior — Middle
Which tool or platform do you think is most suitable for developing a new microservice?
sobes.tech AI
Answer from AI
The most suitable tool for developing a new microservice in Java is Spring Boot. This framework allows for quick creation of standalone, ready-to-run applications with minimal configuration. Spring Boot supports an embedded server, database integration, security system, and many other components, which facilitates microservice development.
Example of a simple microservice in Spring Boot:
@SpringBootApplication
public class MyMicroserviceApplication {
public static void main(String[] args) {
SpringApplication.run(MyMicroserviceApplication.class, args);
}
}
@RestController
public class HelloController {
@GetMapping("/hello")
public String sayHello() {
return "Hello from microservice!";
}
}
Besides Spring Boot, you can consider Micronaut or Quarkus, which are also oriented towards microservice architecture and provide fast startup and low resource consumption.