Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/spring/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
指定Shiro';编程Spring@配置中的s LifecycleBeanPostProcessor导致错误_Spring_Shiro - Fatal编程技术网

指定Shiro';编程Spring@配置中的s LifecycleBeanPostProcessor导致错误

指定Shiro';编程Spring@配置中的s LifecycleBeanPostProcessor导致错误,spring,shiro,Spring,Shiro,我有一个SpringWeb应用程序,我正在进行编程配置。我正在尝试使用ApacheShiro作为我的身份验证框架,并且在将Shiro与Spring集成时遇到了一些问题,特别是在使用编程配置时(因为我决定不想编写大量XML)。这是相关的代码片段: @Configuration //Replaces Spring XML configuration @EnableTransactionManagement //Enables declarative Transaction annotations p

我有一个SpringWeb应用程序,我正在进行编程配置。我正在尝试使用ApacheShiro作为我的身份验证框架,并且在将Shiro与Spring集成时遇到了一些问题,特别是在使用编程配置时(因为我决定不想编写大量XML)。这是相关的代码片段:

@Configuration //Replaces Spring XML configuration
@EnableTransactionManagement //Enables declarative Transaction annotations
public class SpringAppConfig {
    @Bean
    public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
        return new LifecycleBeanPostProcessor();
    }
}

当我启动我的web应用程序时,我会遇到一些错误,Spring无法使用注释处理我的任何bean。

根据本期中的评论:

我应该将该方法声明为
static
,以避免早期创建配置bean(实际上我还不太确定Spring配置机制是如何工作的,这可能就是我遇到此错误的原因)

这可以防止所有错误的发生

@Bean
public static LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
    return new LifecycleBeanPostProcessor();
}