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

org.openl.spring.env.ServletContextPropertySource Maven / Gradle / Ivy

The newest version!
package org.openl.spring.env;

import java.util.Collections;
import jakarta.servlet.ServletContext;

import org.springframework.core.env.EnumerablePropertySource;

import org.openl.util.StringUtils;

public class ServletContextPropertySource extends EnumerablePropertySource {

    public ServletContextPropertySource(String name, ServletContext servletContext) {
        super(name, servletContext);
        ConfigLog.LOG.info("Loading ServletContext init parameters: {} properties.", getPropertyNames().length);
    }

    @Override
    public String[] getPropertyNames() {
        return Collections.list(source.getInitParameterNames()).toArray(StringUtils.EMPTY_STRING_ARRAY);
    }

    @Override
    public String getProperty(String name) {
        return this.source.getInitParameter(name);
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy