All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mayhoo.examples.HelloRestController Maven / Gradle / Ivy

There is a newer version: 3.3.4
Show newest version
package com.mayhoo.examples;

import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

@Slf4j
@RestController
@RequestMapping("hello")
public class HelloRestController {
    @Value("${parent.example.greeting:Hi}")
    private String greeting;

    @GetMapping(path = "/{name}", produces = "application/json")
    public Map sayHello(@PathVariable String name) {
        log.info("sayHello called with param: {}", name);
        return Map.of("greeting", String.format("%s %s!", greeting, name));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy