我有一个简单的弹簧上下文文件如下:
<bean id="acl.provider" class="com.provider.ProviderType" factory-method="getInstance">
<constructor-arg index="0" value="${provider}"/>
</bean>
<bean id="acl.authentication" class="com.provider.AuthenticationFactory">
<constructor-arg index="0">
<value>#{ @acl.provider==T(com.provider.ProviderType).A
?'classpath:cfg/a.spax'
:null}</value>
</constructor-arg>
</bean>
当我初始化上述上下文时,出现以下错误:
Caused by: org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'acl' is defined
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBeanDefinition(DefaultListableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractBeanFactory.getMergedLocalBeanDefinition(AbstractBeanFactory.java:1083)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:274)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.context.expression.BeanFactoryResolver.resolve(BeanFactoryResolver.java:44)
... 124 more
当我将acl.provider
bean 名称更改为aclprovider
(删除.
字符)时,一切正常。
我的问题是:为什么.
字符在 bean 名称中使用并在中使用SpEL
?