POM
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
Config
@SpringBootApplication
@ComponentScan(basePackages = {"com.xxx.*"})
public class App
{
public static void main(String[] args) {
SpringApplication.run(App.class, args);
}
}
Control
@RestController
public class TestControl {
@GetMapping("/hello")
public String hello()
{
return "helloWorld";
}
}
访问
http://localhost:8080/hello