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

com.github.fridujo.sample.TextService Maven / Gradle / Ivy

The newest version!
package com.github.fridujo.sample;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
class TextService {

    private final String literalText;
    private final Optional optionalText;

    TextService(@Value("${text.literal}")
                    String literalText, @Value("${text.optional:}")
                    Optional optionalText) {
        this.literalText = literalText;
        this.optionalText = optionalText;
    }


    public String getLiteralText() {
        return literalText;
    }

    public String getOptionalText() {
        return optionalText.get();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy