Spring Framework PropertyPlaceholderConfigurer - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Spring Framework PropertyPlaceholderConfigurer class.

This code example shows how to use the following methods:setProperties
 
    @Before 
    public void createSpringContext() { 
        try { 
            log.info("creating spring context"); 
            PropertyPlaceholderConfigurer configurer = new PropertyPlaceholderConfigurer();
            Properties properties = new Properties();
            properties.setProperty("temp.dir",
                    TMPDIR);
            configurer.setProperties(properties);
            ctx = new ClassPathXmlApplicationContext();
            ctx.addBeanFactoryPostProcessor(configurer);
            ctx.setConfigLocation("org/kie/spring/timer/conf/spring-conf.xml");
            ctx.refresh();
        } catch (Exception e) {
            log.error("can't create spring context", 
                    e);
            throw new RuntimeException(e);
        } 
    } 
6
CodeRank
This code example shows how to use the following methods:
 * @see javax.servlet.ServletContext#getAttribute(String) 
 * @deprecated in Spring 3.1 in favor of {@link org.springframework.context.support.PropertySourcesPlaceholderConfigurer} 
 * in conjunction with {@link StandardServletEnvironment}. 
 */ 
@Deprecated 
public class ServletContextPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer 
		implements ServletContextAware { 
 
	private boolean contextOverride = false; 
 
	private boolean searchContextAttributes = false; 
 
	private ServletContext servletContext; 
 
 
	/** 
	 * Set whether ServletContext init parameters (and optionally also ServletContext 
	 * attributes) should override local properties within the application. 
	 * Default is "false": ServletContext settings serve as fallback. 
	 * <p>Note that system properties will still override ServletContext settings, 
6
CodeRank
This code example shows how to use the following methods:setProperties
This code example shows how to use the following methods:setIgnoreUnresolvablePlaceholders
     
    private SymbolSource symbolSource;
 
    public SymbolBeanFactoryPostProcessor(SymbolSource symbolSource)
    { 
        super(); 
        this.symbolSource = symbolSource;
        setIgnoreUnresolvablePlaceholders(true);
    } 
 
    @Override 
    protected String resolvePlaceholder(String placeholder, Properties props)
    { 
        try 
        { 
            return symbolSource.valueForSymbol(placeholder);
        } 
        catch(RuntimeException e)
        { 
             return super.resolvePlaceholder(placeholder, props);
6
CodeRank
This code example shows how to use the following methods:
package org.broadleafcommerce.common.extensibility.config; 
 
import org.springframework.beans.factory.config.PropertyPlaceholderConfigurer; 
import org.springframework.core.io.Resource; 
 
public class PropertyConfigurer extends PropertyPlaceholderConfigurer { 
 
    @Override 
    public void setLocation(Resource location) { 
        super.setLocation(location); 
    } 
 
    @Override 
    public void setLocations(Resource[] locations) { 
        super.setLocations(locations); 
    } 
 
} 
6
CodeRank
This code example shows how to use the following methods:setValueSeparator
public class PropertyPlaceholderProcessor extends PropertyPlaceholderConfigurer implements MuleContextAware
{ 
    private MuleContext muleContext;
    private Map factories = new HashMap();
 
    public PropertyPlaceholderProcessor() 
    { 
        setValueSeparator(null);
    } 
 
    @Override 
    protected Properties mergeProperties() throws IOException
    { 
        RegistryProperties props = new RegistryProperties();
        props.putAll(super.mergeProperties());
 
        // MuleContext/MuleConfiguration properties 
        props.put("mule.working.dir", muleContext.getConfiguration().getWorkingDirectory());
         
        if (factories != null)
5
CodeRank
This code example shows how to use the following methods:postProcessBeanFactory, setProperties
	 * @param is       the stream to read the properties from  
	 * @param factory  the factory to configure 
	 */ 
	public static Properties configureFactoryFromInputStream(InputStream is, XmlBeanFactory factory ) {
		 
		PropertyPlaceholderConfigurer cfg = new PropertyPlaceholderConfigurer();
		 
		Properties p = new Properties();
 
		try { 
			p.load(is);
		}  
		catch (IOException e) {
			e.printStackTrace();
		} 
 
		cfg.setProperties(p);
		cfg.postProcessBeanFactory(factory);
		 
		return p;

5
CodeRank
This code example shows how to use the following methods:setIgnoreUnresolvablePlaceholders
 * User: nbaker Date: 4/2/13 
 */ 
public class PentahoPropertyPlaceholderConfigurer extends PropertyPlaceholderConfigurer {
  private ISystemConfig config;
 
  public PentahoPropertyPlaceholderConfigurer( ISystemConfig config ) {
    if ( config == null ) {
      throw new IllegalArgumentException( "ISystemConfig was null" );
    } 
    this.config = config;
    this.setIgnoreUnresolvablePlaceholders( true );
  } 
 
  @Override 
  protected String resolvePlaceholder( String placeholder, Properties props ) {
    // placeholder must be in the form of ID.PROP where 
    String val = this.resolveValue( placeholder );
    if ( val == null ) {
      val = super.resolvePlaceholder( placeholder, props );
    } 
5
CodeRank
This code example shows how to use the following methods:setProperties
	  SimulationRunEntity simulationRun = commandContext.getSimulationRunManager().findSimulationRunWithReferencesById(configuration);
	  SimulationContext.setSimulationRun(simulationRun);
	   
	  //initializeSimulationRun 
	  ClassPathXmlApplicationContext appContext = new ClassPathXmlApplicationContext(simulationRun.getSimulation().getSimulationConfigUrl());
	  PropertyPlaceholderConfigurer propConfig = new PropertyPlaceholderConfigurer();	  
	  Properties properties = new Properties();
	  properties.put("simulationRunId", configuration);
	  propConfig.setProperties(properties);
	  appContext.addBeanFactoryPostProcessor(propConfig);
	  appContext.refresh();
	   
	  SimulationRunHelper runHelper = new NoopSimulationRunHelper();
	  if (appContext.containsBean("simulationRunHelper"))
		  runHelper = (SimulationRunHelper) appContext.getBean("simulationRunHelper");
 
	  try { 
		  runHelper.before( configuration);
		   
		  SimulationRun simRun = (SimulationRun) appContext.getBean("simulationRun");
5
CodeRank
This code example shows how to use the following methods:setProperties
    public synchronized void initializeContext(final ClassLoader classLoader) {
        if (context == null) {// synchronized null check
            // Inject the tenantId as a resolvable placeholder for the bean definitions. 
            Properties properties = findBonitaServerTenantProperties(tenantId);
            properties.put(TENANT_ID, String.valueOf(tenantId));
            PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
            ppc.setProperties(properties);
            SpringPlatformFileSystemBeanAccessor.initializeContext(classLoader);
            final FileSystemXmlApplicationContext platformContext = SpringPlatformFileSystemBeanAccessor.getContext();
            // Delay the refresh so we can set our BeanFactoryPostProcessor to be able to resolve the placeholder. 
            AbsoluteFileSystemXmlApplicationContext localContext = createFileSystemApplicationContext(platformContext);
            localContext.addBeanFactoryPostProcessor(ppc);
 
            localContext.refresh();
            this.context = localContext;
        } 
    } 
 
    protected AbsoluteFileSystemXmlApplicationContext createFileSystemApplicationContext(final FileSystemXmlApplicationContext platformContext) {
        AbsoluteFileSystemXmlApplicationContext localContext = new AbsoluteFileSystemXmlApplicationContext(getResources(), false /* refresh */,
5
CodeRank
See Code Examples for Spring Framework PropertyPlaceholderConfigurer Methods: