Spring multiple @Configuration classes

后端 未结 3 956
后悔当初
后悔当初 2021-02-01 21:54

I am using Spring @Configuration annotation to configure my application.

Currently, I have a single @Configuration class where all my beans are

3条回答
  •  情书的邮戳
    2021-02-01 22:21

    You should be able to autowire them:

    @Configuration 
    public class Conf2 {
        @Autowired
        Conf1 conf1;
        ...
    }
    

    Alternatively, you can autowire beans rather than configurations:

    @Configuration 
    public class Conf2 {
        @Autowired
        Foo foo;
        ...
    }
    

提交回复
热议问题