Spring Security circular bean dependency

后端 未结 5 1381
梦毁少年i
梦毁少年i 2020-12-13 14:25

I\'m currently working on a Vaadin spring application. According to the app specifications, authentication/authorization of the users must be completed by querying database

5条回答
  •  Happy的楠姐
    2020-12-13 14:27

    I also faced same problem today. I used @Lazy in the constructor of one class and it solved my problem:

    lang-java 
    
    public class AService {  
        private BService b;   
        public ApplicantService( @NonNull @Lazy BService b){    
            this.b=b;  
            }
       }  
    
    public class BService {  
        private AService a;   
        public ApplicantService( @NonNull  BService a){     
            this.a=a;  
            }
       } 
    

提交回复
热议问题