I am trying to inject a property into my applicationContext.xml file in my spring boot project:
Application file :
@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);
}
}
As you can see, nothing fancy here... In my src/main/resources/navi.properties file :
USER_INFO_CLS=jp.co.xxx.yyy.fw.service.UserInfoService
in my applicationContext.xml
, I am trying to inject this value :
<bean id="userInfoService" class="${USER_INFO_CLS}"/>
But ./mvnw spring-boot:run
returns the error below :
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}
I read many articles about it (like this one) and it sounds good.... Thanks