0
이 내 META-INF/스프링/beans.xml 환경시로 독립 실행 형 응용 프로그램
<bean id="securityManager" class="org.apache.shiro.mgt.DefaultSecurityManager" />
<bean id="lifecycleBeanPostProcessor" class="org.apache.shiro.spring.LifecycleBeanPostProcessor"/>
<!-- Enable Shiro Annotations for Spring-configured beans. Only run after -->
<!-- the lifecycleBeanProcessor has run: -->
<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean">
<property name="staticMethod" value="org.apache.shiro.SecurityUtils.setSecurityManager"/>
<property name="arguments" ref="securityManager"/>
</bean>
나는 그것을 테스트하기 위해 노력하고 있습니다 :
org.apache.shiro.UnavailableSecurityManagerException: No SecurityManager accessible to the calling code, either bound to the org.apache.shiro.util.ThreadContext or as a vm static singleton. This is an invalid application configuration.
:
public static void main(String[] args) throws Exception {
SecurityUtils.getSecurityManager()
}
나는이 오류가 발생했습니다
은 아마도 당신은 보안 관리자가 작동하기 전에 봄을 부트 스트랩하는 일을해야합니다. 부트 스트랩과 같은 것 [이 답변] (http://stackoverflow.com/a/3659854/274466). – ig0774
@ ig0774 감사드립니다. – kinaesthesia