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

org.spincast.demos.supercalifragilisticexpialidocious.AppConfig Maven / Gradle / Ivy

package org.spincast.demos.supercalifragilisticexpialidocious;

import org.spincast.plugins.config.SpincastConfigDefault;
import org.spincast.plugins.config.SpincastConfigPluginConfig;

import com.google.inject.Inject;

public class AppConfig extends SpincastConfigDefault {

    /**
     * Constructor
     */
    @Inject
    protected AppConfig(SpincastConfigPluginConfig spincastConfigPluginConfig) {
        super(spincastConfigPluginConfig);
    }

    /**
     * We change the port the Server will be started on.
     * 
     * Note that we could also have specified a 
     * default value, for example :
     * return getInteger("server.port", 8899);
     */
    @Override
    public int getHttpServerPort() {
        Integer port = getInteger("server.port");
        if (port == null) {
            throw new RuntimeException("The 'port' configuration is required!");
        }
        return port;
    }

    /**
     * It is recommended to always override the 
     * getPublicUrlBase() configuration.
     * Here, we externalize it and use the default only
     * if no custom value if found.
     */
    @Override
    public String getPublicUrlBase() {
        return getString("api.baseUrl", super.getPublicUrlBase());
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy