[ 
https://issues.apache.org/jira/browse/SHIRO-829?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17393706#comment-17393706
 ] 

chenzhi.xu commented on SHIRO-829:
----------------------------------

 
{code:java}
[INFO] Reactor Summary for Apache Shiro 1.7.2-SNAPSHOT:
[INFO]
[INFO] Apache Shiro ....................................... SUCCESS [  4.248 s]
[INFO] Apache Shiro :: Lang ............................... SUCCESS [ 10.800 s]
[INFO] Apache Shiro :: Cryptography ....................... SUCCESS [  1.256 s]
[INFO] Apache Shiro :: Cryptography :: Core ............... SUCCESS [  6.870 s]
[INFO] Apache Shiro :: Cryptography :: Hashing ............ SUCCESS [ 14.231 s]
[INFO] Apache Shiro :: Cryptography :: Ciphers ............ SUCCESS [  8.195 s]
[INFO] Apache Shiro :: Event .............................. SUCCESS [  7.803 s]
[INFO] Apache Shiro :: Cache .............................. SUCCESS [  3.609 s]
[INFO] Apache Shiro :: Configuration ...................... SUCCESS [  1.294 s]
[INFO] Apache Shiro :: Configuration :: Core .............. SUCCESS [  6.589 s]
[INFO] Apache Shiro :: Configuration :: OGDL .............. SUCCESS [  8.414 s]
[INFO] Apache Shiro :: Core ............................... SUCCESS [ 51.554 s]
[INFO] Apache Shiro :: Web ................................ SUCCESS [ 29.722 s]
[INFO] Apache Shiro :: Support ............................ SUCCESS [  4.456 s]
[INFO] Apache Shiro :: Support :: AspectJ ................. SUCCESS [  7.526 s]
[INFO] Apache Shiro :: Support :: EHCache ................. SUCCESS [  6.200 s]
[INFO] Apache Shiro :: Support :: Hazelcast ............... SUCCESS [  8.244 s]
[INFO] Apache Shiro :: Support :: Quartz .................. SUCCESS [  3.656 s]
[INFO] Apache Shiro :: Support :: Spring .................. SUCCESS [ 11.656 s]
[INFO] Apache Shiro :: Support :: Guice ................... SUCCESS [ 10.821 s]
[INFO] Apache Shiro :: Support :: CAS ..................... SUCCESS [  7.665 s]
[INFO] Apache Shiro :: Support :: Spring Boot Parent ...... SUCCESS [  1.310 s]
[INFO] Apache Shiro :: Support :: Spring Boot ............. SUCCESS [ 11.528 s]
[INFO] Apache Shiro :: Support :: Spring Boot Web ......... SUCCESS [ 13.092 s]
[INFO] Apache Shiro :: Support :: Servlet Plugin .......... SUCCESS [  2.401 s]
[INFO] Apache Shiro :: Support :: JAX-RS .................. SUCCESS [  7.420 s]
[INFO] Apache Shiro :: Support :: Karaf Features .......... SUCCESS [  1.788 s]
[INFO] Apache Shiro :: Tools .............................. SUCCESS [  1.286 s]
[INFO] Apache Shiro :: Tools :: Hasher .................... SUCCESS [  4.581 s]
[INFO] Apache Shiro :: All (aggregate jar) ................ SUCCESS [  6.728 s]
[INFO] Apache Shiro :: Samples ............................ SUCCESS [  8.182 s]
[INFO] Apache Shiro :: Samples :: AspectJ ................. SUCCESS [  6.043 s]
[INFO] Apache Shiro :: Samples :: Quick Start ............. SUCCESS [  3.171 s]
[INFO] Apache Shiro :: Integration Tests .................. SUCCESS [  1.627 s]
[INFO] Apache Shiro :: ITs :: Support ..................... SUCCESS [  4.068 s]
[INFO] Apache Shiro :: Samples :: Web ..................... SUCCESS [ 10.863 s]
[INFO] Apache Shiro :: Samples :: Spring Quickstart ....... SUCCESS [  9.102 s]
[INFO] Apache Shiro :: Samples :: Spring MVC .............. SUCCESS [  5.771 s]
[INFO] Apache Shiro :: Samples :: Spring-Hibernate ........ SUCCESS [ 35.448 s]
[INFO] Apache Shiro :: Samples :: Spring Boot ............. SUCCESS [  3.367 s]
[INFO] Apache Shiro :: Samples :: Spring Boot Web ......... SUCCESS [  3.863 s]
[INFO] Apache Shiro :: Samples :: Guice Web ............... SUCCESS [ 14.407 s]
[INFO] Apache Shiro :: Samples :: Quick Start Guice ....... SUCCESS [ 17.102 s]
[INFO] Apache Shiro :: Samples :: Servlet Plugin .......... SUCCESS [ 13.873 s]
[INFO] Apache Shiro :: Samples :: JAX-RS .................. SUCCESS [ 27.542 s]
[INFO] Apache Shiro :: ITs :: Guice 3 ..................... SUCCESS [ 12.256 s]
[INFO] Apache Shiro :: ITs :: Guice 4 ..................... SUCCESS [ 20.106 s]
[INFO] Apache Shiro :: Test Coverage ...................... SUCCESS [  6.900 s]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  07:50 min
[INFO] Finished at: 2021-08-05T16:17:00+08:00
[INFO] ------------------------------------------------------------------------
{code}
Thank you, it's passed. It is recommended to modify the +shiro.previousVersion+ 
of the corresponding branch.

 

> beanPostProcessor and FactoryBean cause aop to fail in the same Configuration
> -----------------------------------------------------------------------------
>
>                 Key: SHIRO-829
>                 URL: https://issues.apache.org/jira/browse/SHIRO-829
>             Project: Shiro
>          Issue Type: Bug
>          Components: Integration: Spring
>    Affects Versions: 1.7.1
>         Environment: springboot:1.5.21.RELEASE
> spring:4.3.24.RELEASE
>            Reporter: chenzhi.xu
>            Assignee: Les Hazlewood
>            Priority: Major
>             Fix For: 1.7.2, 2.0.0, 1.8.0
>
>         Attachments: build.log, image-2021-08-03-18-24-02-370.png, 
> image-2021-08-05-15-55-50-006.png, screenshot-1.png, screenshot-2.png, 
> screenshot-3.png
>
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> When _LifecycleBeanPostProcessor_ and _ShiroFilterFactoryBean_ are defined in 
> the same configuration class, Realm's dependency aop (@Transactional and 
> cache) is invalidated. Please look below:
> {code:java}
> @Configuration
> public class ShiroConfig {
>     @Bean("lifecycleBeanPostProcessor")
>     public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
>         return new LifecycleBeanPostProcessor();
>     }
>     @Bean("securityManager")
>     public SecurityManager securityManager(OAuth2Realm oAuth2Realm) {
>         DefaultWebSecurityManager securityManager = new 
> DefaultWebSecurityManager();
>         securityManager.setRealm(oAuth2Realm);
>         securityManager.setRememberMeManager(null);
>         return securityManager;
>     }
>     @Bean("shiroFilter")
>     public ShiroFilterFactoryBean shiroFilter(SecurityManager 
> securityManager) {
>         return shiroFilter;
>     }
>     @Bean
>     public AuthorizationAttributeSourceAdvisor 
> authorizationAttributeSourceAdvisor(SecurityManager securityManager) {
>         AuthorizationAttributeSourceAdvisor advisor = new 
> AuthorizationAttributeSourceAdvisor();
>         advisor.setSecurityManager(securityManager);
>         return advisor;
>     }
> }
> {code}
> {code:java}
> @Slf4j
> @Component
> public class OAuth2Realm extends AuthorizingRealm {
>     @Autowired
>     private ISysSsoService sysSsoService;
>     ......
> }
> {code}
> When the _ISysSsoService_ method is annotated by @Transactional, 
> @Transactional will become invalid.
> I can fix it like this
> {code:java}
> @Configuration
> public class ShiroConfig {
>     public static class LifecycleBeanPostProcessorConfiguration {
>         @Bean("lifecycleBeanPostProcessor")
>         public LifecycleBeanPostProcessor lifecycleBeanPostProcessor() {
>             return new LifecycleBeanPostProcessor();
>         }
>     }
>     ......
> }{code}
> But I think this is a bug
> see spring-beans-4.3.24.RELEASE.jar 
> _org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory#getTypeForFactoryBean_
> !image-2021-08-03-18-24-02-370.png!
> At 1 in the figure, we want to parse the return type of the FactoryBean, and 
> enter the logic of Figure 2 when it cannot be parsed according to the 
> signature. Because LifecycleBeanPostProcessor is initialized earlier than the 
> ordinary bean, the Configuration class already exists as a FactoryBean, so 
> that the dependent instantiation will continue.
> I have found a solution to change the signature of _ShiroFilterFactoryBean_ to
> *public class ShiroFilterFactoryBean implements 
> FactoryBean<{color:#de350b}AbstractShiroFilter{color}>, BeanPostProcessor* 
>  



--
This message was sent by Atlassian Jira
(v8.3.4#803005)

Reply via email to