Я пытаюсь внедрить свойство в мой applicationContext. Файл xml в моем весеннем загрузочном проекте:
Файл приложения:
@SpringBootApplication
@PropertySource("classpath:navi.properties") // <== injection here
@ImportResource({"classpath*:applicationContext.xml"}) // <== load the xml setting file
public class CApplication {
public static void main(String[] args) {
SpringApplication.run(CApplication.class, args);
}
}
Как видите, здесь ничего необычного ... В моем файле src / main / resources / navi.properties:
USER_INFO_CLS=jp.co.xxx.yyy.fw.service.UserInfoService
в моем applicationContext.xml
я пытаюсь ввести это значение:
<bean id="userInfoService" class="${USER_INFO_CLS}"/>
Но ./mvnw spring-boot:run
возвращает ошибку ниже:
Caused by: org.springframework.beans.factory.CannotLoadBeanClassException: Cannot find class [${USER_INFO_CLS}] for bean with name 'userInfoService' defined in class path resource [applicationContext.xml]; nested exception is java.lang.ClassNotFoundException: ${USER_INFO_CLS}
Я прочитал много статей об этом (например, one ), и это звучит хорошо .... Спасибо