import org.springframework.stereotype.Service;
import reactor.core.publisher.Mono;
import java.util.HashMap;
import java.util.Map;
@Service
public class UserService {
private final Map<Long, User> users = new HashMap<>();
public UserService() {
users.put(1L, new User("Wim"));
users.put(2L, new User("Simon"));
users.put(3L, new User("Siva"));
users.put(4L, new User("Josh"));
}
public Mono<User> findUserById(Long userId) {
User user = users.get(userId);
if (user == null) {
throw new UserNotFoundException(userId);
}
return Mono.just(user);
}
}