【发布时间】:2012-05-11 16:48:18
【问题描述】:
我想知道配置中的“#{request.userPrincipal.name}”。当我运行我的春季社交项目时,它总是在“#{request.userPrincipal.name}”处出现错误,如果我设置一个诸如“123”之类的值,我的项目运行良好。出了什么问题,是否有任何其他配置而不是“#{request.userPrincipal.name}”?
<bean id="connectionRepository" factory-method="createConnectionRepository" factory-bean="usersConnectionRepository" scope="request">
<constructor-arg value="#{request.userPrincipal.name}" />
<aop:scoped-proxy proxy-target-class="false" />
</bean>
【问题讨论】:
-
你得到的确切错误是什么?
-
@Seong 您是否尝试使用 props 文件填充 #{request.userPrincipal.name} 的值,如果是,那么我认为您应该使用 ${request.userPrincipal.name} ,而不是 $的 #
-
是的,我想使用 ${request.userPrincipal.name} 但我不知道如何设置正确的值!它总是有这样的错误:org.springframework.expression.spel.SpelEvaluationException: EL1007E:(pos 22): Field or property 'name' cannot be found on null
标签: spring spring-social