2022-08-03

Resolved: has been injected into other beans in its raw version as part of a circular reference

 
Resolved by referring to:
  1. https://www.baeldung.com/circular-dependencies-in-spring#2-use-lazy
  2. https://blog.51cto.com/u_13478207/3336383



has been injected into other beans in its raw version as part of a circular reference, but has eventually been wrapped. This means that said other beans do not use the final version of the bean. This is often the result of over-eager type matching - consider using 'getBeanNamesOfType' with the 'allowEagerInit' flag turned off, for example.



structure to tell the story...

@Service
public class MainService{

    @Autowired
    private ServiceParent
}

@Service
public class ServiceParent{

    @Autowired
    private ServiceChild
    
}

@Service
public class ServiceChild{

    @Autowired
    private ServiceParent
    
}



then will hit the exception while maven run the application locally/at server.





@Service
public class ServiceChild{

    @Autowired
    @Lazy
    private ServiceParent
    
}
















No comments:

Google Referrals