代碼如下:
<?xml version="1.0" encoding="UTF-8"?>
xmlns:p="http://www.springframework.org/schema/p"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:util="http://www.springframework.org/schema/util"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/util
http://www.springframework.org/schema/util/spring-util-3.0.xsd">
在使用#{100 gt 80}也就是100>80這一代碼時報錯,異常如下:
Exception in thread "main" org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'person' defined in class path resource [ApplicationContext.xml]: Initialization of bean failed; nested exception is org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.ParseException: Parsing problem: EL1066E:(pos 4): Error occurred during expression parse: mismatched input 'gt' expecting EOF
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:482)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:411)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:382)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:271)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:268)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:170)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:470)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:719)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:378)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:139)
at org.springframework.context.support.ClassPathXmlApplicationContext.(ClassPathXmlApplicationContext.java:83)
at com.springinaction.springido1.TestPerson.main(TestPerson.java:10)
Caused by: org.springframework.beans.factory.BeanExpressionException: Expression parsing failed; nested exception is org.springframework.expression.ParseException: Parsing problem: EL1066E:(pos 4): Error occurred during expression parse: mismatched input 'gt' expecting EOF
at org.springframework.context.expression.StandardBeanExpressionResolver.evaluateExpression(StandardBeanExpressionResolver.java:64)
at org.springframework.context.expression.AbstractBeanExpressionResolver.evaluate(AbstractBeanExpressionResolver.java:86)
at org.springframework.beans.factory.support.AbstractBeanFactory.evaluateBeanDefinitionString(AbstractBeanFactory.java:1156)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.evaluate(BeanDefinitionValueResolver.java:184)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:155)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1237)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1005)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:474)
... 13 more
Caused by: org.springframework.expression.ParseException: Parsing problem: EL1066E:(pos 4): Error occurred during expression parse: mismatched input 'gt' expecting EOF
at org.springframework.expression.spel.SpelExpressionParser.doParseExpression(SpelExpressionParser.java:79)
at org.springframework.expression.common.TemplateAwareExpressionParser.parseExpression(TemplateAwareExpressionParser.java:31)
at org.springframework.expression.spel.SpelExpressionParser.parseExpression(SpelExpressionParser.java:89)
at org.springframework.expression.spel.SpelExpressionParser.parseExpression(SpelExpressionParser.java:1)
at org.springframework.context.expression.StandardBeanExpressionResolver.evaluateExpression(StandardBeanExpressionResolver.java:56)
... 20 more
Caused by: org.springframework.expression.spel.SpelException: EL1066E:(pos 4): Error occurred during expression parse: mismatched input 'gt' expecting EOF
at org.springframework.expression.spel.internal.SpringExpressionsParserExtender.displayRecognitionError(SpringExpressionsParserExtender.java:52)
at org.antlr.runtime.BaseRecognizer.reportError(BaseRecognizer.java:144)
at org.springframework.expression.spel.generated.SpringExpressionsParser.expr(SpringExpressionsParser.java:158)
at org.springframework.expression.spel.SpelExpressionParser.doParseExpression(SpelExpressionParser.java:70)
... 24 more
Caused by: MismatchedTokenException(36!=-1)
at org.antlr.runtime.BaseRecognizer.mismatch(BaseRecognizer.java:117)
at org.antlr.runtime.BaseRecognizer.match(BaseRecognizer.java:99)
at org.springframework.expression.spel.generated.SpringExpressionsParser.expr(SpringExpressionsParser.java:145)
... 25 more
>