pom
Код: Выделить всё
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0
org.springframework.boot
spring-boot-starter-parent
2.7.5
com.iet.testing
registro.trattamenti.be
0.0.1-SNAPSHOT
war
registro.trattamenti.be
registro
17
org.springframework.boot
spring-boot-starter-web
jakarta.servlet
jakarta.servlet-api
5.0.0
provided
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-maven-plugin
false
Код: Выделить всё
package com.iet.testing.registro.trattamenti.be;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
@SpringBootApplication
public class Application extends SpringBootServletInitializer {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
@Override
protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
return builder.sources(Application.class);
}
}
Код: Выделить всё
package com.iet.testing.registro.trattamenti.be.controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
@RestController
public class HelloWorldController {
private final String HELLO_WORLD= "Hello, world!";
@GetMapping("/hello")
public String printHelloWorld(){
return HELLO_WORLD;
}
}
Подробнее здесь: https://stackoverflow.com/questions/793 ... -2-java-17
Мобильная версия