Skip to content

@Value doesn't allow a default value [SPR-6806] #11472

Closed
@spring-projects-issues

Description

@spring-projects-issues

Juergen Zimmermann opened SPR-6806 and commented

I'm using nightly build #571.

When trying to define a default value I get the following stacktrace in my testcase which I'll upload immediately:

06.02.2010 10:58:20 org.springframework.context.support.AbstractApplicationConte
xt prepareRefresh
INFO: Refreshing org.springframework.context.support.ClassPathXmlApplicationCont
ext@17fa65e: startup date [Sat Feb 06 10:58:20 CET 2010]; root of context hierar
chy
06.02.2010 10:58:20 org.springframework.beans.factory.xml.XmlBeanDefinitionReade
r loadBeanDefinitions
INFO: Loading XML bean definitions from class path resource [testcase/spring.xml
]
06.02.2010 10:58:21 org.springframework.context.weaving.DefaultContextLoadTimeWe
aver setBeanClassLoader
INFO: Found Spring's JVM agent for instrumentation
06.02.2010 10:58:21 org.springframework.aop.aspectj.AspectJWeaverMessageHandler
handleMessage
INFO: [AspectJ] AspectJ Weaver Version 1.6.8 built on Friday Jan 8, 2010 at 21:5
3:37 GMT
06.02.2010 10:58:21 org.springframework.aop.aspectj.AspectJWeaverMessageHandler
handleMessage
INFO: [AspectJ] register classloader sun.misc.Launcher$AppClassLoader@fabe9
06.02.2010 10:58:21 org.springframework.aop.aspectj.AspectJWeaverMessageHandler
handleMessage
INFO: [AspectJ] using configuration /C:/Users/Public/Documents/temp/testcase-spr
ing/src/META-INF/aop.xml
06.02.2010 10:58:21 org.springframework.aop.aspectj.AspectJWeaverMessageHandler
handleMessage
INFO: [AspectJ] no aspects registered. Disabling weaver for class loader sun.mis
c.Launcher$AppClassLoader@fabe9
06.02.2010 10:58:21 org.springframework.beans.factory.support.DefaultListableBea
nFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.
DefaultListableBeanFactory@55d93d: defining beans [springConfig,springProperties
,org.springframework.context.annotation.internalConfigurationAnnotationProcessor
,org.springframework.context.annotation.internalAutowiredAnnotationProcessor,org
.springframework.context.annotation.internalRequiredAnnotationProcessor,org.spri
ngframework.context.annotation.internalCommonAnnotationProcessor,org.springframe
work.context.weaving.AspectJWeavingEnabler#0,loadTimeWeaver,org.springframework.
aop.config.internalAutoProxyCreator,springProps]; root of factory hierarchy
06.02.2010 10:58:21 org.springframework.beans.factory.support.DefaultSingletonBe
anRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.Default
ListableBeanFactory@55d93d: defining beans [springConfig,springProperties,org.sp
ringframework.context.annotation.internalConfigurationAnnotationProcessor,org.sp
ringframework.context.annotation.internalAutowiredAnnotationProcessor,org.spring
framework.context.annotation.internalRequiredAnnotationProcessor,org.springframe
work.context.annotation.internalCommonAnnotationProcessor,org.springframework.co
ntext.weaving.AspectJWeavingEnabler#0,loadTimeWeaver,org.springframework.aop.con
fig.internalAutoProxyCreator,springProps]; root of factory hierarchy
06.02.2010 10:58:21 org.springframework.context.weaving.DefaultContextLoadTimeWe
aver destroy
INFO: Removing all registered transformers for class loader: sun.misc.Launcher$A
ppClassLoader
Exception in thread "main" org.springframework.beans.factory.BeanCreationExcepti
on: Error creating bean with name 'springConfig': Injection of autowired depende
ncies failed; nested exception is org.springframework.beans.factory.BeanCreation
Exception: Could not autowire field: private int testcase.SpringConfig.integerPr
op; nested exception is org.springframework.beans.factory.BeanExpressionExceptio
n: Expression parsing failed; nested exception is org.springframework.expression
.spel.SpelParseException: EL1041E:(pos 23): After parsing a valid expression, th
ere is still more data in the expression: 'colon(:)'
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
ostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java
:283)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.populateBean(AbstractAutowireCapableBeanFactory.java:1055)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.doCreateBean(AbstractAutowireCapableBeanFactory.java:511)
at org.springframework.beans.factory.support.AbstractAutowireCapableBean
Factory.createBean(AbstractAutowireCapableBeanFactory.java:450)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getOb
ject(AbstractBeanFactory.java:290)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistr
y.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBe
an(AbstractBeanFactory.java:287)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean
(AbstractBeanFactory.java:189)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
preInstantiateSingletons(DefaultListableBeanFactory.java:562)
at org.springframework.context.support.AbstractApplicationContext.finish
BeanFactoryInitialization(AbstractApplicationContext.java:868)
at org.springframework.context.support.AbstractApplicationContext.refres
h(AbstractApplicationContext.java:420)
at org.springframework.context.support.ClassPathXmlApplicationContext.<i
nit>(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.<i
nit>(ClassPathXmlApplicationContext.java:83)
at testcase.Main.main(Main.java:14)
Caused by: org.springframework.beans.factory.BeanCreationException: Could not au
towire field: private int testcase.SpringConfig.integerProp; nested exception is
org.springframework.beans.factory.BeanExpressionException: Expression parsing f
ailed; nested exception is org.springframework.expression.spel.SpelParseExceptio
n: EL1041E:(pos 23): After parsing a valid expression, there is still more data
in the expression: 'colon(:)'
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
ostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.j
ava:504)
at org.springframework.beans.factory.annotation.InjectionMetadata.inject
(InjectionMetadata.java:84)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
ostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java
:280)
... 13 more
Caused by: org.springframework.beans.factory.BeanExpressionException: Expression
parsing failed; nested exception is org.springframework.expression.spel.SpelPar
seException: EL1041E:(pos 23): After parsing a valid expression, there is still
more data in the expression: 'colon(:)'
at org.springframework.context.expression.StandardBeanExpressionResolver
.evaluate(StandardBeanExpressionResolver.java:140)
at org.springframework.beans.factory.support.AbstractBeanFactory.evaluat
eBeanDefinitionString(AbstractBeanFactory.java:1245)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
doResolveDependency(DefaultListableBeanFactory.java:696)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.
resolveDependency(DefaultListableBeanFactory.java:685)
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanP
ostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.j
ava:475)
... 15 more
Caused by: org.springframework.expression.spel.SpelParseException: EL1041E:(pos
23): After parsing a valid expression, there is still more data in the expressio
n: 'colon(:)'
at org.springframework.expression.spel.standard.InternalSpelExpressionPa
rser.doParseExpression(InternalSpelExpressionParser.java:116)
at org.springframework.expression.spel.standard.SpelExpressionParser.doP
arseExpression(SpelExpressionParser.java:56)
at org.springframework.expression.spel.standard.SpelExpressionParser.doP
arseExpression(SpelExpressionParser.java:1)
at org.springframework.expression.common.TemplateAwareExpressionParser.p
arseExpressions(TemplateAwareExpressionParser.java:128)
at org.springframework.expression.common.TemplateAwareExpressionParser.p
arseTemplate(TemplateAwareExpressionParser.java:74)
at org.springframework.expression.common.TemplateAwareExpressionParser.p
arseExpression(TemplateAwareExpressionParser.java:64)
at org.springframework.context.expression.StandardBeanExpressionResolver
.evaluate(StandardBeanExpressionResolver.java:119)
... 19 more


Affects: 3.0 GA

Attachments:

Metadata

Metadata

Assignees

No one assigned

    Labels

    in: coreIssues in core modules (aop, beans, core, context, expression)status: invalidAn issue that we don't feel is valid

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions