Ну я так понимаю, в какой-то мере это всё-таки возможно, потому что вот что люди пишут:
since you have a \@Configuration class, why not define your beans in there with \@Bean and remove all the \@Autowired and \@Component annotations? When you use \@Autowired and \@Component annotations, you make your code depend on Spring. If you define your beans with \@Bean, your Spring configuration is separate from your code. It is not so clean letting your code depend on Spring. Imagine you create a library, then you force users of your library to use the same dependency injection framework while they may already be using another one.@Configuration class, why not define your beans in there with \@Bean and remove all the \
@Autowired and \
@Component annotations? When you use \
@Autowired and \
@Component annotations, you make your code depend on Spring. If you define your beans with \@Bean, your Spring configuration is separate from your code. It is not so clean letting your code depend on Spring. Imagine you create a library, then you force users of your library to use the same dependency injection framework while they may already be using another one.