Reputation: 189
I am using Spring Expression Language (SpEL) and created a sample program. The code snippet is
ExpressionParser parser=new SpelExpressionParser();
Expression expression=parser.parseExpression("Hello SPEL");
But got below error.
Exception in thread "main" org.springframework.expression.spel.SpelParseException: EL1041E:(pos 6): After parsing a valid expression, there is still more data in the expression: 'SPEL'
at org.springframework.expression.spel.standard.InternalSpelExpressionParser.doParseExpression(InternalSpelExpressionParser.java:116)
at org.springframework.expression.spel.standard.SpelExpressionParser.doParseExpression(SpelExpressionParser.java:56)
at org.springframework.expression.spel.standard.SpelExpressionParser.doParseExpression(SpelExpressionParser.java:1)
at org.springframework.expression.common.TemplateAwareExpressionParser.parseExpression(TemplateAwareExpressionParser.java:66)
at org.springframework.expression.common.TemplateAwareExpressionParser.parseExpression(TemplateAwareExpressionParser.java:56)
Upvotes: 18
Views: 73332
Reputation: 468
I was getting this:
EL1041E: After parsing a valid expression, there is still more data in the expression: 'colon(:)'
and I tried finding something in the answers above. Finally I found that in the latest version of a SpringBoot config file, the value, had been converted to a map and so the URL which was the value of the old version was now a name/value pair separated by the colon in http://...
.
Old value in application.yml
my:
connection:
url:http://www.example.com
New value
my:
connection:
url: "{
url1: 'http://www.example.com',
url1: 'http://www.example.com',
url1: 'http://www.example.com'
}"
The solution to the error message was to update to the config file with the map. This gave the code what it wanted.
Upvotes: 0
Reputation: 1738
I am using Spring web flow and moved from ognl to Spring 5 WebFlowSpringELExpressionParser and replaced the @package.class.method() with bean.method() and bean was declared in servlet.xml.
Upvotes: 0
Reputation: 1
If you are putting that in your spring beans xml file try putting it like this
#{'Hello Spel'}.
Upvotes: 0
Reputation: 464
I m facing the same exception when injecting a bean with xml file :
<bean id="myBean"
class="mypackage.mybean"
destroy-method="destroy"
p:filePath=
"#{systemProperties'java.io.tmpdir'}#{systemProperties'file.separator'}somefile.txt"/>
the problem disappear when using: [] :
<bean id="myBean"
class="mypackage.mybean"
destroy-method="destroy"
p:filePath=
"#{systemProperties['java.io.tmpdir']}#{systemProperties['file.separator']}somefile.txt"/>
My this help you to solve your problem ,
for more information about this problem please refer to this issue :
Upvotes: 1
Reputation: 1650
Try this
Expression expression=parser.parseExpression("'Hello SPRING'");
Upvotes: 2