Commit 0c7dea4c by Patryk Czarnik

odczyt czasu

parent 4e759ea5
package com.example.demo; package com.example.demo;
import java.time.LocalTime;
import org.springframework.stereotype.Controller; import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody; import org.springframework.web.bind.annotation.ResponseBody;
...@@ -13,4 +15,13 @@ public class PierwszyKontroler { ...@@ -13,4 +15,13 @@ public class PierwszyKontroler {
return "Hello world"; return "Hello world";
} }
// Dodaj kolejną metodę, która zwraca w wyniku info o bieżącym czasie
// LocalTime.now()
@GetMapping("/czas")
@ResponseBody
public LocalTime podajCzas() {
return LocalTime.now();
}
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment