错误o.s.web.context.ContextLoader-上下文初始化失败

时间:2018-12-14 09:48:31

标签: java spring

我从2天后就被这个错误震惊。有帮助吗?

 ERROR o.s.web.context.ContextLoader - Context initialization failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'sessionFilter' defined in file [/usr/local/tomcat/webapps/portal/WEB-INF/classes/META-INF/spring/applicationContext-security.xml]: Unsatisfied dependency expressed through constructor argument with index 1 of type [com.xxx.cloud.common.sessionclient.retrievers.SessionRetrievalStrategy]: : Error creating bean with name 'securityConfig': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'xxx/abc/realm_id' is defined: not found in JNDI environment; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'securityConfig': Injection of resource dependencies failed; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No bean named 'xxx/abc/realm_id' is defined: not found in JNDI environment

代码:

@Resource(mappedName = "xyz/abc/realm_id")
private String assId;

@Bean
public String assId() {
    return assId;
}

applicationContext-Security.xml,其中定义了bean,但没有拾取

<beans:bean id="xyz/abc/realm_id" class="com.xxxxxxxx.SecurityConfig">
            <beans:property name="assId" value="123456789"/>
        </beans:bean>

我们不能使用tomcat context.xml。

0 个答案:

没有答案