前提・実現したいこと
vscodeでSpring bootの実装をしようとしています。
ローカル(8080/hello)にHelloWorldを出したいです。
参考:https://tech-lab.sios.jp/archives/19941#i-8
発生してる問題・エラーメッセージ
該当コード
PracticeApplication.java
1package com.example.practice; 2 3import org.springframework.boot.SpringApplication; 4import org.springframework.boot.autoconfigure.SpringBootApplication; 5 6@SpringBootApplication 7public class PracticeApplication { 8 9 public static void main(String[] args) { 10 SpringApplication.run(PracticeApplication.class, args); 11 } 12 13} 14
HelloController.java
1package com.example.practice.controller; 2 3import org.springframework.stereotype.Controller; 4import org.springframework.web.bind.annotation.RequestMapping; 5 6@Controller 7public class HelloController { 8 @RequestMapping("/hello") 9 public String index() { 10 return "hello"; 11 } 12}
hello.html
1<!DOCTYPE html> 2<html> 3<head> 4 <meta charset="UTF-8"> 5 <title>Hello!!!</title> 6</head> 7<body> 8 <h1>HelloWorld</h1> 9</body> 10</html>
試したこと
リセットしたり、port番号変えたり、8080で立ち上がってるプロジェクトをkillしてみたりしました。
あなたの回答
tips
プレビュー