What are the ways to get ApplicationContext object in Spring?
问题 Hi i want to know what are the different ways to get ApplicationContext Object in Spring? I know only one way that is, ApplicationContext context = new ClassPathXmlApplicationContext("Beans.xml"); is there any other ways? if it is please let me know. Thanks. 回答1: You can also use annotation based configuration @Configuration public class Config { @Bean public Bean1 bean1() { return new Bean1(); } public static void main(String[] args) { ApplicationContext ctx = new