Files
java-devops-demo/jbang/broken/SpringDefaultPackage.java
T

30 lines
919 B
Java

//JAVA 25+
//DEPS org.springframework.boot:spring-boot-dependencies:4.2.0@pom
//DEPS org.springframework.boot:spring-boot-starter-webmvc
//RUNTIME_OPTIONS -Dserver.port=8090 -Dspring.main.banner-mode=off
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* A whole Spring Boot web application in a single file. The BOM (@pom) pins every
* Spring Boot dependency, so the starter needs no version of its own.
*/
@SpringBootApplication
@RestController
public class SpringDefaultPackage {
@GetMapping("/hello")
String hello() {
return "Hello from a single-file Spring Boot app";
}
public static void main(String[] args) {
SpringApplication.run(SpringDefaultPackage.class, args);
}
}