org.springframework.beans.factory.support.BeanDefinitionBuilder Java Examples
The following examples show how to use
org.springframework.beans.factory.support.BeanDefinitionBuilder.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: CuratorFrameworkBeanDefinitionParser.java From zookeeper-spring with Apache License 2.0 | 6 votes |
@Override protected AbstractBeanDefinition parseInternal(Element element, ParserContext parserContext) { final BeanDefinitionBuilder beanDefBuilder = BeanDefinitionBuilder.rootBeanDefinition(CuratorFrameworkFactoryBean.class); beanDefBuilder.setRole(ROLE_APPLICATION); beanDefBuilder.getRawBeanDefinition().setSource(parserContext.extractSource(element)); beanDefBuilder.addPropertyValue("connectString", element.getAttribute("connect-string")); Element retryPolicyElement = DomUtils.getChildElementByTagName(element, "retry-policy"); if (retryPolicyElement != null) { Element retryPolicyBeanElement = DomUtils.getChildElements(retryPolicyElement).get(0); BeanDefinitionHolder retryPolicy = parserContext.getDelegate().parseBeanDefinitionElement(retryPolicyBeanElement, beanDefBuilder.getBeanDefinition()); beanDefBuilder.addPropertyValue("retryPolicy", retryPolicy); } Node namespace = element.getAttributeNode("namespace"); if (namespace != null) { beanDefBuilder.addPropertyValue("namespace", namespace.getNodeValue()); } return beanDefBuilder.getBeanDefinition(); }
Example #2
Source File: RedissonNestedElementAwareDecorator.java From redisson with Apache License 2.0 | 6 votes |
private void parseNested(Element element, String eltType, ParserContext parserContext, BeanDefinitionBuilder builder, RedissonNamespaceParserSupport helper) { NodeList list = element.getElementsByTagNameNS( RedissonNamespaceParserSupport.REDISSON_NAMESPACE, eltType); if (list.getLength() == 1) { Element elt = (Element) list.item(0); if (StringUtils.hasText(referenceAttribute)) { helper.setAttribute(elt, referenceAttribute, helper.getAttribute(element, RedissonNamespaceParserSupport.ID_ATTRIBUTE)); helper.setAttribute(elt, RedissonNamespaceParserSupport.REDISSON_REF_ATTRIBUTE, helper.getAttribute(element, RedissonNamespaceParserSupport.REDISSON_REF_ATTRIBUTE)); } parserContext.getDelegate() .parseCustomElement(elt, builder.getRawBeanDefinition()); } }
Example #3
Source File: CacheAdviceParser.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { builder.addPropertyReference("cacheManager", CacheNamespaceHandler.extractCacheManager(element)); CacheNamespaceHandler.parseKeyGenerator(element, builder.getBeanDefinition()); List<Element> cacheDefs = DomUtils.getChildElementsByTagName(element, DEFS_ELEMENT); if (cacheDefs.size() >= 1) { // Using attributes source. List<RootBeanDefinition> attributeSourceDefinitions = parseDefinitionsSources(cacheDefs, parserContext); builder.addPropertyValue("cacheOperationSources", attributeSourceDefinitions); } else { // Assume annotations source. builder.addPropertyValue("cacheOperationSources", new RootBeanDefinition("org.springframework.cache.annotation.AnnotationCacheOperationSource")); } }
Example #4
Source File: BeanConfigurerSupportTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void configureBeanPerformsAutowiringByTypeIfAppropriateBeanWiringInfoResolverIsPluggedIn() throws Exception { TestBean beanInstance = new TestBean(); // spouse for autowiring by type... BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(TestBean.class); builder.addConstructorArgValue("David Gavurin"); DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); factory.registerBeanDefinition("Mmm, I fancy a salad!", builder.getBeanDefinition()); BeanWiringInfoResolver resolver = mock(BeanWiringInfoResolver.class); given(resolver.resolveWiringInfo(beanInstance)).willReturn(new BeanWiringInfo(BeanWiringInfo.AUTOWIRE_BY_TYPE, false)); BeanConfigurerSupport configurer = new StubBeanConfigurerSupport(); configurer.setBeanFactory(factory); configurer.setBeanWiringInfoResolver(resolver); configurer.configureBean(beanInstance); assertEquals("Bean is evidently not being configured (for some reason)", "David Gavurin", beanInstance.getSpouse().getName()); }
Example #5
Source File: RequiredAnnotationBeanPostProcessorTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void testWithRequiredPropertyOmitted() { try { DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); BeanDefinition beanDef = BeanDefinitionBuilder .genericBeanDefinition(RequiredTestBean.class) .addPropertyValue("name", "Rob Harrop") .addPropertyValue("favouriteColour", "Blue") .addPropertyValue("jobTitle", "Grand Poobah") .getBeanDefinition(); factory.registerBeanDefinition("testBean", beanDef); factory.addBeanPostProcessor(new RequiredAnnotationBeanPostProcessor()); factory.preInstantiateSingletons(); fail("Should have thrown BeanCreationException"); } catch (BeanCreationException ex) { String message = ex.getCause().getMessage(); assertTrue(message.contains("Property")); assertTrue(message.contains("age")); assertTrue(message.contains("testBean")); } }
Example #6
Source File: GeneratorBeanDefinitionParser.java From idworker with Apache License 2.0 | 6 votes |
@Override protected AbstractBeanDefinition parseInternal(final Element element, final ParserContext parserContext) { Class<?> generatorClass = null; if (ConfigConstants.SNOWFLAKE.equals(generatorType)) { generatorClass = SnowflakeGenerator.class; } else if (ConfigConstants.COMPRESS_UUID.equals(generatorType)) { generatorClass = CompressUUIDGenerator.class; } else { throw new IllegalArgumentException("unknown registryType"); } BeanDefinitionBuilder result = BeanDefinitionBuilder.rootBeanDefinition(generatorClass); // snowflake 生成策略 if (generatorClass.isAssignableFrom(SnowflakeGenerator.class)) { result.addConstructorArgValue( GeneratorRegisteryBuilder.buildWorkerNodeRegisterBeanDefinition(element, parserContext)); // 去掉低并发模式配置解析 // result.addPropertyValue(PropertyConstants.LOW_CONCURRENCY, // getAttributeValue(element, // GeneratorBeanDefinitionTag.LOW_CONCURRENCY)); result.setInitMethodName("init"); } return result.getBeanDefinition(); }
Example #7
Source File: ExecutorBeanDefinitionParser.java From spring-analysis-note with MIT License | 6 votes |
private void configureRejectionPolicy(Element element, BeanDefinitionBuilder builder) { String rejectionPolicy = element.getAttribute("rejection-policy"); if (!StringUtils.hasText(rejectionPolicy)) { return; } String prefix = "java.util.concurrent.ThreadPoolExecutor."; String policyClassName; if (rejectionPolicy.equals("ABORT")) { policyClassName = prefix + "AbortPolicy"; } else if (rejectionPolicy.equals("CALLER_RUNS")) { policyClassName = prefix + "CallerRunsPolicy"; } else if (rejectionPolicy.equals("DISCARD")) { policyClassName = prefix + "DiscardPolicy"; } else if (rejectionPolicy.equals("DISCARD_OLDEST")) { policyClassName = prefix + "DiscardOldestPolicy"; } else { policyClassName = rejectionPolicy; } builder.addPropertyValue("rejectedExecutionHandler", new RootBeanDefinition(policyClassName)); }
Example #8
Source File: RequiredAnnotationBeanPostProcessorTests.java From spring4-understanding with Apache License 2.0 | 6 votes |
@Test public void testWithThreeRequiredPropertiesOmitted() { try { DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); BeanDefinition beanDef = BeanDefinitionBuilder .genericBeanDefinition(RequiredTestBean.class) .addPropertyValue("name", "Rob Harrop") .getBeanDefinition(); factory.registerBeanDefinition("testBean", beanDef); factory.addBeanPostProcessor(new RequiredAnnotationBeanPostProcessor()); factory.preInstantiateSingletons(); fail("Should have thrown BeanCreationException"); } catch (BeanCreationException ex) { String message = ex.getCause().getMessage(); assertTrue(message.contains("Properties")); assertTrue(message.contains("age")); assertTrue(message.contains("favouriteColour")); assertTrue(message.contains("jobTitle")); assertTrue(message.contains("testBean")); } }
Example #9
Source File: MBeanExporterTests.java From spring-analysis-note with MIT License | 6 votes |
@Test // SPR-3302 public void testBeanNameCanBeUsedInNotificationListenersMap() throws Exception { String beanName = "charlesDexterWard"; BeanDefinitionBuilder testBean = BeanDefinitionBuilder.rootBeanDefinition(JmxTestBean.class); DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); factory.registerBeanDefinition(beanName, testBean.getBeanDefinition()); factory.preInstantiateSingletons(); Object testBeanInstance = factory.getBean(beanName); MBeanExporter exporter = new MBeanExporter(); exporter.setServer(getServer()); Map<String, Object> beansToExport = new HashMap<>(); beansToExport.put("test:what=ever", testBeanInstance); exporter.setBeans(beansToExport); exporter.setBeanFactory(factory); StubNotificationListener listener = new StubNotificationListener(); exporter.setNotificationListenerMappings(Collections.singletonMap(beanName, listener)); start(exporter); }
Example #10
Source File: CloudScanHelper.java From spring-cloud-connectors with Apache License 2.0 | 6 votes |
private void registerServiceBean(BeanDefinitionRegistry registry, ServiceInfo serviceInfo) { try { GenericCloudServiceConnectorFactory serviceFactory = new GenericCloudServiceConnectorFactory(serviceInfo.getId(), null); serviceFactory.setBeanFactory((BeanFactory) registry); serviceFactory.afterPropertiesSet(); BeanDefinitionBuilder definitionBuilder = BeanDefinitionBuilder.genericBeanDefinition(ScannedServiceWrapper.class); definitionBuilder.addConstructorArgValue(serviceFactory); definitionBuilder.getRawBeanDefinition().setAttribute( "factoryBeanObjectType", serviceFactory.getObjectType()); registry.registerBeanDefinition(serviceInfo.getId(), definitionBuilder.getBeanDefinition()); } catch (Exception ex) { logger.fine("Unable to create service for " + serviceInfo.getId() + " during service scanning. Skipping."); } }
Example #11
Source File: RedissonDefinitionParser.java From redisson with Apache License 2.0 | 6 votes |
private void parseConfigTypes(Element element, String configType, BeanDefinitionBuilder redissonDef, ParserContext parserContext) { BeanDefinitionBuilder builder = helper.createBeanDefinitionBuilder(element, parserContext, null); //Use factory method on the Config bean AbstractBeanDefinition bd = builder.getRawBeanDefinition(); bd.setFactoryMethodName("use" + StringUtils.capitalize(configType)); bd.setFactoryBeanName(parserContext.getContainingComponent().getName()); String id = parserContext.getReaderContext().generateBeanName(bd); helper.registerBeanDefinition(builder, id, helper.parseAliase(element), parserContext); helper.parseAttributes(element, parserContext, builder); redissonDef.addDependsOn(id); parseChildElements(element, id, null, redissonDef, parserContext); parserContext.getDelegate().parseQualifierElements(element, bd); }
Example #12
Source File: RedissonNamespaceParserSupport.java From redisson with Apache License 2.0 | 6 votes |
private BeanDefinitionBuilder preInvoke(Element element, Object obj, String method, Object[] args, ParserContext parserContext, boolean factory) { Class<?> beanClass = BeanMethodInvoker.class; if (factory) { beanClass = MethodInvokingFactoryBean.class; } BeanDefinitionBuilder builder = createBeanDefinitionBuilder(element, parserContext, beanClass); if (obj instanceof Class) { builder.addPropertyValue("staticMethod", ((Class<?>) obj).getName() + "." + method); } else { builder.addPropertyValue("targetMethod", method); } builder.addPropertyValue("arguments", args); if (element != null) { parserContext.getDelegate().parseQualifierElements(element, builder.getRawBeanDefinition()); } return builder; }
Example #13
Source File: ScriptFactoryPostProcessorTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void testPrototypeScriptedBean() throws Exception { GenericApplicationContext ctx = new GenericApplicationContext(); ctx.registerBeanDefinition("messenger", BeanDefinitionBuilder.rootBeanDefinition(StubMessenger.class).getBeanDefinition()); BeanDefinitionBuilder scriptedBeanBuilder = BeanDefinitionBuilder.rootBeanDefinition(GroovyScriptFactory.class); scriptedBeanBuilder.setScope(BeanDefinition.SCOPE_PROTOTYPE); scriptedBeanBuilder.addConstructorArgValue(DELEGATING_SCRIPT); scriptedBeanBuilder.addPropertyReference("messenger", "messenger"); final String BEAN_WITH_DEPENDENCY_NAME = "needsMessenger"; ctx.registerBeanDefinition(BEAN_WITH_DEPENDENCY_NAME, scriptedBeanBuilder.getBeanDefinition()); ctx.registerBeanDefinition("scriptProcessor", createScriptFactoryPostProcessor(true)); ctx.refresh(); Messenger messenger1 = (Messenger) ctx.getBean(BEAN_WITH_DEPENDENCY_NAME); Messenger messenger2 = (Messenger) ctx.getBean(BEAN_WITH_DEPENDENCY_NAME); assertNotSame(messenger1, messenger2); }
Example #14
Source File: DefaultListableBeanFactoryTests.java From spring-analysis-note with MIT License | 6 votes |
@Test public void testExplicitScopeInheritanceForChildBeanDefinitions() { String theChildScope = "bonanza!"; RootBeanDefinition parent = new RootBeanDefinition(); parent.setScope(RootBeanDefinition.SCOPE_PROTOTYPE); AbstractBeanDefinition child = BeanDefinitionBuilder.childBeanDefinition("parent").getBeanDefinition(); child.setBeanClass(TestBean.class); child.setScope(theChildScope); DefaultListableBeanFactory factory = new DefaultListableBeanFactory(); factory.registerBeanDefinition("parent", parent); factory.registerBeanDefinition("child", child); AbstractBeanDefinition def = (AbstractBeanDefinition) factory.getBeanDefinition("child"); assertEquals("Child 'scope' not overriding parent scope (it must).", theChildScope, def.getScope()); }
Example #15
Source File: CacheAdviceParser.java From spring-analysis-note with MIT License | 6 votes |
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { builder.addPropertyReference("cacheManager", CacheNamespaceHandler.extractCacheManager(element)); CacheNamespaceHandler.parseKeyGenerator(element, builder.getBeanDefinition()); List<Element> cacheDefs = DomUtils.getChildElementsByTagName(element, DEFS_ELEMENT); if (!cacheDefs.isEmpty()) { // Using attributes source. List<RootBeanDefinition> attributeSourceDefinitions = parseDefinitionsSources(cacheDefs, parserContext); builder.addPropertyValue("cacheOperationSources", attributeSourceDefinitions); } else { // Assume annotations source. builder.addPropertyValue("cacheOperationSources", new RootBeanDefinition("org.springframework.cache.annotation.AnnotationCacheOperationSource")); } }
Example #16
Source File: PropertyResourceConfigurerTests.java From spring-analysis-note with MIT License | 5 votes |
@Test public void testPropertyOverrideConfigurerWithInvalidPropertiesFile() { BeanDefinition def = BeanDefinitionBuilder.genericBeanDefinition(IndexedTestBean.class).getBeanDefinition(); factory.registerBeanDefinition("tb", def); PropertyOverrideConfigurer poc = new PropertyOverrideConfigurer(); poc.setLocations(TEST_PROPS, XTEST_PROPS); poc.setIgnoreResourceNotFound(true); poc.postProcessBeanFactory(factory); IndexedTestBean tb = (IndexedTestBean) factory.getBean("tb"); assertEquals(99, tb.getArray()[0].getAge()); assertEquals("test", ((TestBean) tb.getList().get(1)).getName()); }
Example #17
Source File: ShadowRuleBeanDefinitionParser.java From shardingsphere with Apache License 2.0 | 5 votes |
/** * Parse shadow rule element. * * @param element element * @return bean definition of shadow rule */ @Override protected AbstractBeanDefinition parseInternal(final Element element, final ParserContext parserContext) { BeanDefinitionBuilder factory = BeanDefinitionBuilder.rootBeanDefinition(ShadowRuleConfiguration.class); factory.addConstructorArgValue(element.getAttribute(ShadowDataSourceBeanDefinitionParserTag.COLUMN_CONFIG_TAG)); factory.addConstructorArgValue(parseShadowMappings(DomUtils.getChildElementByTagName(element, ShadowDataSourceBeanDefinitionParserTag.MAPPINGS_CONFIG_TAG))); return factory.getBeanDefinition(); }
Example #18
Source File: MemoryPersistenceSupportBeanFactoryImpl.java From statefulj with Apache License 2.0 | 5 votes |
@Override public BeanDefinition buildFactoryBean(Class<?> statefulClass) { BeanDefinition factoryBean = BeanDefinitionBuilder .genericBeanDefinition(FactoryImpl.class) .getBeanDefinition(); return factoryBean; }
Example #19
Source File: MonitorBeanDefinitionParser.java From Thunder with Apache License 2.0 | 5 votes |
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { super.doParse(element, parserContext, builder); String typeAttributeName = ThunderConstant.TYPE_ATTRIBUTE_NAME; String type = element.getAttribute(typeAttributeName); List<MonitorType> monitorTypes = null; if (StringUtils.isNotEmpty(type)) { monitorTypes = new ArrayList<MonitorType>(); MonitorType monitorType = null; String[] typeArray = StringUtils.split(type, ","); for (String typeValue : typeArray) { monitorType = MonitorType.fromString(typeValue); monitorTypes.add(monitorType); } } else { monitorTypes = Arrays.asList(MonitorType.LOG_SERVICE); } LOG.info("Monitor types are {}", monitorTypes); MonitorEntity monitorEntity = new MonitorEntity(); monitorEntity.setTypes(monitorTypes); cacheContainer.setMonitorEntity(monitorEntity); builder.addPropertyValue(createBeanName(MonitorEntity.class), monitorEntity); List<MonitorExecutor> monitorExecutors = createMonitorExecutors(monitorTypes); builder.addPropertyValue(createBeanName(MonitorExecutor.class) + "s", monitorExecutors); }
Example #20
Source File: MybatisRepositoryConfigExtension.java From spring-data-mybatis with Apache License 2.0 | 5 votes |
@Override public void postProcess(BeanDefinitionBuilder builder, XmlRepositoryConfigurationSource config) { Optional<String> enableDefaultTransactions = config .getAttribute(ENABLE_DEFAULT_TRANSACTIONS_ATTRIBUTE); if (enableDefaultTransactions.isPresent() && StringUtils.hasText(enableDefaultTransactions.get())) { builder.addPropertyValue(ENABLE_DEFAULT_TRANSACTIONS_ATTRIBUTE, enableDefaultTransactions.get()); } }
Example #21
Source File: TaskScheduleCommandTemplate.java From spring-cloud-dataflow with Apache License 2.0 | 5 votes |
public TaskScheduleCommandTemplate(JLineShellComponent dataFlowShell, ApplicationContext applicationContext) { this.dataFlowShell = dataFlowShell; ConfigurableListableBeanFactory beanFactory = ((AnnotationConfigServletWebServerApplicationContext) applicationContext) .getBeanFactory(); schedule = Mockito.mock(SchedulerService.class); BeanDefinitionBuilder builder = BeanDefinitionBuilder.rootBeanDefinition(TaskSchedulerController.class); builder.addConstructorArgValue(schedule); DefaultListableBeanFactory listableBeanFactory = (DefaultListableBeanFactory) beanFactory; listableBeanFactory.setAllowBeanDefinitionOverriding(true); listableBeanFactory.registerBeanDefinition("taskSchedulerController", builder.getBeanDefinition()); }
Example #22
Source File: AbstractEncryptionBeanDefinitionParser.java From jasypt with Apache License 2.0 | 5 votes |
protected final void processBooleanAttribute(final Element element, final BeanDefinitionBuilder builder, final String attributeName, final String propertyName) { final String attributeValue = element.getAttribute(attributeName); if (StringUtils.hasText(attributeValue)) { final Boolean attributeBooleanValue = Boolean.valueOf(attributeValue); builder.addPropertyValue(propertyName, attributeBooleanValue); } }
Example #23
Source File: ColumnBeanDefinitionParser.java From jdal with Apache License 2.0 | 5 votes |
/** * {@inheritDoc} */ @Override protected void postProcess(BeanDefinitionBuilder beanDefinition, Element element) { beanDefinition.setScope("prototype"); if (element.hasAttribute(RENDERER_ATTRIBUTE)) beanDefinition.addPropertyReference(RENDERER_ATTRIBUTE, element.getAttribute(RENDERER_ATTRIBUTE)); }
Example #24
Source File: SolrRepositoryConfigExtension.java From dubbox with Apache License 2.0 | 5 votes |
@Override public void registerBeansForRoot(BeanDefinitionRegistry registry, RepositoryConfigurationSource configurationSource) { super.registerBeansForRoot(registry, configurationSource); registerSolrMappingContextIfNotPresent(registry, configurationSource); registerIfNotAlreadyRegistered( BeanDefinitionBuilder.genericBeanDefinition(SolrExceptionTranslator.class).getBeanDefinition(), registry, "solrExceptionTranslator", configurationSource); }
Example #25
Source File: UserBeanDefinitionParser.java From geekbang-lessons with Apache License 2.0 | 5 votes |
private void setPropertyValue(String attributeName, Element element, BeanDefinitionBuilder builder) { String attributeValue = element.getAttribute(attributeName); if (StringUtils.hasText(attributeValue)) { builder.addPropertyValue(attributeName, attributeValue); // -> <property name="" value=""/> } }
Example #26
Source File: UtilNamespaceHandler.java From spring4-understanding with Apache License 2.0 | 5 votes |
@Override protected void doParse(Element element, ParserContext parserContext, BeanDefinitionBuilder builder) { Set<Object> parsedSet = parserContext.getDelegate().parseSetElement(element, builder.getRawBeanDefinition()); builder.addPropertyValue("sourceSet", parsedSet); String setClass = element.getAttribute("set-class"); if (StringUtils.hasText(setClass)) { builder.addPropertyValue("targetSetClass", setClass); } String scope = element.getAttribute(SCOPE_ATTRIBUTE); if (StringUtils.hasLength(scope)) { builder.setScope(scope); } }
Example #27
Source File: AnnotationDrivenJmsBeanDefinitionParser.java From spring-analysis-note with MIT License | 5 votes |
private static void registerInfrastructureBean( ParserContext parserContext, BeanDefinitionBuilder builder, String beanName) { builder.setRole(BeanDefinition.ROLE_INFRASTRUCTURE); parserContext.getRegistry().registerBeanDefinition(beanName, builder.getBeanDefinition()); BeanDefinitionHolder holder = new BeanDefinitionHolder(builder.getBeanDefinition(), beanName); parserContext.registerComponent(new BeanComponentDefinition(holder)); }
Example #28
Source File: ServerFactoryBeanDefinitionParser.java From cxf with Apache License 2.0 | 5 votes |
@Override protected void mapAttribute(BeanDefinitionBuilder bean, Element e, String name, String val) { if ("endpointName".equals(name) || "serviceName".equals(name)) { QName q = parseQName(e, val); bean.addPropertyValue(name, q); } else { mapToProperty(bean, name, val); } }
Example #29
Source File: CustomSchemaParser.java From rice with Educational Community License v2.0 | 5 votes |
/** * Parses a bean based on the namespace of the bean. * * @param tag - The Element to be parsed. * @param parent - The parent bean that the tag is nested in. * @param parserContext - Provided information and functionality regarding current bean set. * @return The parsed bean. */ protected Object parseBean(Element tag, BeanDefinitionBuilder parent, ParserContext parserContext) { if (tag.getNamespaceURI().compareTo("http://www.springframework.org/schema/beans") == 0 || tag.getLocalName() .equals("bean")) { return parseSpringBean(tag, parserContext); } else { return parseCustomBean(tag, parent, parserContext); } }
Example #30
Source File: AbstractEncryptionBeanDefinitionParser.java From jasypt with Apache License 2.0 | 5 votes |
protected final void processIntegerAttribute(final Element element, final BeanDefinitionBuilder builder, final String attributeName, final String propertyName) { final String attributeValue = element.getAttribute(attributeName); if (StringUtils.hasText(attributeValue)) { try { final Integer attributeIntegerValue = Integer.valueOf(attributeValue); builder.addPropertyValue(propertyName, attributeIntegerValue); } catch (final NumberFormatException e) { throw new NumberFormatException( "Config attribute \"" + attributeName + "\" is not a valid integer"); } } }