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

com.payu.ratel.config.beans.JbossPropertySelfAddressProvider Maven / Gradle / Ivy

There is a newer version: 1.2.12
Show newest version
package com.payu.ratel.config.beans;

import org.springframework.core.env.Environment;

import com.google.common.net.HostAndPort;

public class JbossPropertySelfAddressProvider implements SelfAddressProvider {

    public static final String JBOSS_BIND_ADDRESS = "jboss.bind.address";
    public static final String JBOSS_BIND_PORT = "jboss.bind.port";
    private final Environment environment;

    public JbossPropertySelfAddressProvider(Environment environment) {
        this.environment = environment;
    }

    @Override
    public boolean canProvide() {
        return environment.containsProperty(JBOSS_BIND_ADDRESS);
    }

    @Override
    public HostAndPort getHostAndPort() {
        final String host = environment.getProperty(JBOSS_BIND_ADDRESS);
        final String port = environment.getProperty(JBOSS_BIND_PORT, "8080");
        return HostAndPort.fromParts(host, Integer.parseInt(port));
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy