Developer 역할 Spring 골격 smoke #4
1 changed files with 21 additions and 0 deletions
21
src/main/java/com/example/demo/service/HelloService.java
Normal file
21
src/main/java/com/example/demo/service/HelloService.java
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
package com.example.demo.service;
|
||||
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
public class HelloService {
|
||||
|
||||
private static final String GREETING_TEMPLATE = "Hello, %s!";
|
||||
private static final String DEFAULT_GREETING = "Hello, World!";
|
||||
|
||||
public String getGreeting() {
|
||||
return DEFAULT_GREETING;
|
||||
}
|
||||
|
||||
public String getGreetingFor(String name) {
|
||||
if (name == null || name.isBlank()) {
|
||||
return DEFAULT_GREETING;
|
||||
}
|
||||
return String.format(GREETING_TEMPLATE, name);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue