
[英]Why can't I use an apache httpcomponents object in spring-boot, even though it is listed in the MVN dependancies?
[英]Why spring boot is loading another component even though i am not importing explicitly?
我没有使用@import
批注,尽管上下文能够加载bean(SalesService),但它应该引发异常以查找代码。
@SpringBootApplication
public class App {
public static void main(String[] args) {
ApplicationContext context = (ApplicationContext) SpringApplication.run(CustomerConfig.class);
CustomerService customer = (CustomerService) context.getBean("customerBean");
customer.printMessage("setting message for CustomerService");
SalesService sales = (SalesService)context.getBean("salesBean");
sales.printMessage("setting message for SalesService");
}
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.