org.springframework.expression.spel.SpelEvaluationException: EL1005E:(pos 0): Type cannot be found

简介:

今天在完成Spring项目的时候遇到了一个类似于下面的异常:

10.03.2010 13:53:53 org.apache.catalina.core.StandardWrapperValve invoke
SCHWERWIEGEND: Servlet.service() for servlet default threw exception
org.springframework.expression.spel.SpelEvaluationException: EL1005E:(pos 0): Type cannot be found 'com.example.Comparison.Operator'
    at org.springframework.expression.spel.support.StandardTypeLocator.findType(StandardTypeLocator.java:79)
    at org.springframework.expression.spel.ExpressionState.findType(ExpressionState.java:136)
    at org.springframework.expression.spel.ast.TypeReference.getValueInternal(TypeReference.java:45)
    at org.springframework.expression.spel.ast.CompoundExpression.getValueInternal(CompoundExpression.java:52)
    at org.springframework.expression.spel.ast.SpelNodeImpl.getValue(SpelNodeImpl.java:93)
    at org.springframework.expression.spel.standard.SpelExpression.getValue(SpelExpression.java:88)
    at org.springframework.web.servlet.tags.EvalTag.doEndTag(EvalTag.java:118)

大致描述一下场景:

<?xml version="1.0" encoding="UTF-8"?>

<beans xmlns="http://www.springframework.org/schema/beans"
       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.xsd">


    <util:map id="contractQueryStrategyHolder">
        <entry key="#{T(com.example.Comparison.Operator).xxx}" value-ref="bbbb" />
    </util:map>

</beans>

OperatorComparison的内部类。后来启动失败就出现上面的异常。解决方案其实很简单,只需要把配置修改为下面的就好:

    <util:map id="contractQueryStrategyHolder">
        <entry key="#{T(com.example.Comparison$Operator).xxx}" value-ref="bbbb" />
    </util:map>

目录
相关文章
|
5月前
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias ‘order‘. Caus
Caused by: org.apache.ibatis.type.TypeException: Could not resolve type alias ‘order‘. Caus
71 0
IDEA添加Swagger2:Parameter 0 of method linkDiscoverers in org. springframework hateoas.config.Hateoasconfiguration required a single bean, but 15 were found:
IDEA添加Swagger2:Parameter 0 of method linkDiscoverers in org. springframework hateoas.config.Hateoasconfiguration required a single bean, but 15 were found
|
2月前
Consider defining a bean of type 'org.springframework.security.authentication.AuthenticationManager' in your configuration.
Consider defining a bean of type 'org.springframework.security.authentication.AuthenticationManager' in your configuration.
64 0
|
3月前
|
XML 数据格式
Could not autowire. No beans of ‘VideoDao‘ type found.
Could not autowire. No beans of ‘VideoDao‘ type found.
|
Java Spring
required a bean of type ‘org.springframework.web.client.RestTemplate‘ that could not be found.
required a bean of type ‘org.springframework.web.client.RestTemplate‘ that could not be found.
required a bean of type ‘org.springframework.web.client.RestTemplate‘ that could not be found.
required a bean of type ‘org.springframework.data.redis.core.RedisTemplate‘ that could not be found.
required a bean of type ‘org.springframework.data.redis.core.RedisTemplate‘ that could not be found.
297 0
使用pageHelper报错 Type definition error: [simple type, classXXXX]
使用pageHelper报错 Type definition error: [simple type, classXXXX]
|
JavaScript 前端开发
org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression...
org.thymeleaf.exceptions.TemplateProcessingException: Could not parse as expression...
133 0
Cause: the class org.apache.tools.ant.taskdefs.optional.junit.JUnitTask was not found
Cause: the class org.apache.tools.ant.taskdefs.optional.junit.JUnitTask was not found
111 0
Error creating bean with name ‘org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0‘
Error creating bean with name ‘org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0‘
125 0