/** * Set the environment properties used to construct the {@code JMXConnector} * as {@code java.util.Properties} (String key/value pairs). */ public void setEnvironment(Properties environment) { CollectionUtils.mergePropertiesIntoMap(environment, this.environment); }
/** * Map URL paths to handler bean names. * This is the typical way of configuring this HandlerMapping. * <p>Supports direct URL matches and Ant-style pattern matches. For syntax * details, see the {@link org.springframework.util.AntPathMatcher} javadoc. * @param mappings properties with URLs as keys and bean names as values * @see #setUrlMap */ public void setMappings(Properties mappings) { CollectionUtils.mergePropertiesIntoMap(mappings, this.urlMap); }
/** * Map URL paths to handler bean names. * This is the typical way of configuring this HandlerMapping. * <p>Supports direct URL matches and Ant-style pattern matches. For syntax details, * see the {@link org.springframework.web.util.pattern.PathPattern} javadoc. * @param mappings properties with URLs as keys and bean names as values * @see #setUrlMap */ public void setMappings(Properties mappings) { CollectionUtils.mergePropertiesIntoMap(mappings, this.urlMap); }
/** * Specify JPA properties, to be passed into * {@code EntityManagerFactory.createEntityManager(Map)} (if any). * <p>Can be populated with a String "value" (parsed via PropertiesEditor) * or a "props" element in XML bean definitions. * @see javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map) */ public void setJpaProperties(Properties jpaProperties) { CollectionUtils.mergePropertiesIntoMap(jpaProperties, this.jpaPropertyMap); }
/** * Specify JPA properties, to be passed into * {@code Persistence.createEntityManagerFactory} (if any). * <p>Can be populated with a String "value" (parsed via PropertiesEditor) or a * "props" element in XML bean definitions. * @see javax.persistence.Persistence#createEntityManagerFactory(String, java.util.Map) * @see javax.persistence.spi.PersistenceProvider#createContainerEntityManagerFactory(javax.persistence.spi.PersistenceUnitInfo, java.util.Map) */ public void setJpaProperties(Properties jpaProperties) { CollectionUtils.mergePropertiesIntoMap(jpaProperties, this.jpaPropertyMap); }
/** * Specify bean validation properties to be passed to the validation provider. * <p>Can be populated with a String "value" (parsed via PropertiesEditor) * or a "props" element in XML bean definitions. * @see javax.validation.Configuration#addProperty(String, String) */ public void setValidationProperties(Properties jpaProperties) { CollectionUtils.mergePropertiesIntoMap(jpaProperties, this.validationPropertyMap); }
/** * Set static attributes from a {@code java.util.Properties} object, * for all views returned by this resolver. * <p>This is the most convenient way to set static attributes. Note that * static attributes can be overridden by dynamic attributes, if a value * with the same name is included in the model. * <p>Can be populated with a String "value" (parsed via PropertiesEditor) * or a "props" element in XML bean definitions. * @see org.springframework.beans.propertyeditors.PropertiesEditor * @see AbstractView#setAttributes */ public void setAttributes(Properties props) { CollectionUtils.mergePropertiesIntoMap(props, this.staticAttributes); }
/** * Set static attributes for this view from a * {@code java.util.Properties} object. * <p>"Static" attributes are fixed attributes that are specified in * the View instance configuration. "Dynamic" attributes, on the other hand, * are values passed in as part of the model. * <p>This is the most convenient way to set static attributes. Note that * static attributes can be overridden by dynamic attributes, if a value * with the same name is included in the model. * <p>Can be populated with a String "value" (parsed via PropertiesEditor) * or a "props" element in XML bean definitions. * @see org.springframework.beans.propertyeditors.PropertiesEditor */ public void setAttributes(Properties attributes) { CollectionUtils.mergePropertiesIntoMap(attributes, this.staticAttributes); }
/** * Set the environment properties used to construct the {@code JMXConnectorServer} * as {@code java.util.Properties} (String key/value pairs). */ public void setEnvironment(@Nullable Properties environment) { CollectionUtils.mergePropertiesIntoMap(environment, this.environment); }
/** * Set the environment properties used to construct the {@code JMXConnector} * as {@code java.util.Properties} (String key/value pairs). */ public void setEnvironment(Properties environment) { CollectionUtils.mergePropertiesIntoMap(environment, this.environment); }
/** * Specify JPA properties, to be passed into * {@code EntityManagerFactory.createEntityManager(Map)} (if any). * <p>Can be populated with a String "value" (parsed via PropertiesEditor) * or a "props" element in XML bean definitions. * @see javax.persistence.EntityManagerFactory#createEntityManager(java.util.Map) */ public void setJpaProperties(@Nullable Properties jpaProperties) { CollectionUtils.mergePropertiesIntoMap(jpaProperties, this.jpaPropertyMap); }
/** * Specify bean validation properties to be passed to the validation provider. * <p>Can be populated with a String "value" (parsed via PropertiesEditor) * or a "props" element in XML bean definitions. * @see javax.validation.Configuration#addProperty(String, String) */ public void setValidationProperties(Properties jpaProperties) { CollectionUtils.mergePropertiesIntoMap(jpaProperties, this.validationPropertyMap); }
/** * Set the environment properties used to construct the {@code JMXConnectorServer} * as {@code java.util.Properties} (String key/value pairs). */ public void setEnvironment(@Nullable Properties environment) { CollectionUtils.mergePropertiesIntoMap(environment, this.environment); }
/** * Create a new JNDI initial context. Invoked by {@link #getContext}. * <p>The default implementation use this template's environment settings. * Can be subclassed for custom contexts, e.g. for testing. * @return the initial Context instance * @throws NamingException in case of initialization errors */ protected Context createInitialContext() throws NamingException { Hashtable<?, ?> icEnv = null; Properties env = getEnvironment(); if (env != null) { icEnv = new Hashtable<>(env.size()); CollectionUtils.mergePropertiesIntoMap(env, icEnv); } return new InitialContext(icEnv); }
/** * Merges the {@code Properties} configured in the {@code mappings} and * {@code mappingLocations} into the final {@code Properties} instance * used for {@code ObjectName} resolution. */ @Override public void afterPropertiesSet() throws IOException { this.mergedMappings = new Properties(); CollectionUtils.mergePropertiesIntoMap(this.mappings, this.mergedMappings); if (this.mappingLocations != null) { for (Resource location : this.mappingLocations) { if (logger.isDebugEnabled()) { logger.debug("Loading JMX object name mappings file from " + location); } PropertiesLoaderUtils.fillProperties(this.mergedMappings, location); } } }
CollectionUtils.mergePropertiesIntoMap(mappings, schemaMappings); this.schemaMappings = schemaMappings;
CollectionUtils.mergePropertiesIntoMap(mappings, handlerMappings); this.handlerMappings = handlerMappings;
/** * Create a new JNDI initial context. Invoked by {@link #getContext}. * <p>The default implementation use this template's environment settings. * Can be subclassed for custom contexts, e.g. for testing. * @return the initial Context instance * @throws NamingException in case of initialization errors */ protected Context createInitialContext() throws NamingException { Hashtable<?, ?> icEnv = null; Properties env = getEnvironment(); if (env != null) { icEnv = new Hashtable<>(env.size()); CollectionUtils.mergePropertiesIntoMap(env, icEnv); } return new InitialContext(icEnv); }
/** * Return a merged Properties instance containing both the * loaded properties and properties set on this FactoryBean. */ protected Properties mergeProperties() throws IOException { Properties result = new Properties(); if (this.localOverride) { // Load properties from file upfront, to let local properties override. loadProperties(result); } if (this.localProperties != null) { for (Properties localProp : this.localProperties) { CollectionUtils.mergePropertiesIntoMap(localProp, result); } } if (!this.localOverride) { // Load properties from file afterwards, to let those properties override. loadProperties(result); } return result; }
@Test public void testMergePropertiesIntoMap() { Properties defaults = new Properties(); defaults.setProperty("prop1", "value1"); Properties props = new Properties(defaults); props.setProperty("prop2", "value2"); props.put("prop3", Integer.valueOf(3)); Map<String, String> map = new HashMap<>(); map.put("prop4", "value4"); CollectionUtils.mergePropertiesIntoMap(props, map); assertEquals("value1", map.get("prop1")); assertEquals("value2", map.get("prop2")); assertEquals(Integer.valueOf(3), map.get("prop3")); assertEquals("value4", map.get("prop4")); }