This commit is contained in:
Inohara 2023-02-25 16:54:43 +04:00
parent 10980a9096
commit 50b59892fb
4 changed files with 4 additions and 4 deletions

View File

@ -5,7 +5,7 @@ import org.springframework.web.bind.annotation.*;
@RestController
@CrossOrigin
public class Controllers {
@GetMapping("/hello")
@GetMapping("/")
public @ResponseBody String hello(@RequestParam(value = "name", required = false, defaultValue = "World") String name) {
return String.format("Hello %s!", name);
}

View File

@ -13,7 +13,7 @@ public class SpeakerController {
}
@GetMapping("/hello")
public String hello(@RequestParam(defaultValue = "Привет") String name,
public String hello(@RequestParam(defaultValue = "мир") String name,
@RequestParam(defaultValue = "ru") String lang){
return speakerService.say(name, lang);
}

View File

@ -2,7 +2,7 @@ package com.example.demo.speaker.domain;
import org.springframework.stereotype.Component;
@Component(value = "ru")
public class SpeakerRus implements Speaker{
@Override
public String say(){

View File

@ -14,6 +14,6 @@ public class SpeakerService {
public String say(String name, String lang){
final Speaker speaker = (Speaker) applicationContext.getBean(lang);
return String.format("Hello %s %s!", speaker.say(), name);
return String.format("%s %s!", speaker.say(), name);
}
}