Код: Выделить всё
@ComponentScan("com.main.config")
public class Application {
public static void main(String[] args) {
try(var context = new AnnotationConfigApplicationContext()){
MyBean mybean = context.getBean(MyBean.class);
System.out.println(mybean.getMessage());
}
}}
Код: Выделить всё
try(var context = new AnnotationConfigApplicationContext(ProjectConfig.class))
Исключение в потоке "main" java.lang.IllegalStateException: org.springframework.context.annotation.AnnotationConfigApplicationContext@4c70fda8 еще не обновлен
почему необходимо обновить контекст?. Почему @ComponentScan здесь не работает.
Подробнее здесь: https://stackoverflow.com/questions/790 ... ponentscan
Мобильная версия