문제

I am trying to put my url in wink resource into the property file I have in spring.

When I am trying to use spring @Value annotation to access that property, I am getting it as null.

Wink says for using property in wink, we need to configure custom property bean referenced here http://wink.apache.org/1.0/html/5.5%20Spring%20Integration.html .

But this again is not working. I think its half information.

I want to use the property defined in properties file

spring.properties

my.server.url=http://xx:xx

In my resource I am using this like

myResource.java

@Value("${my.server.url}")
private String myServerUrl;

Getting myServerUrl as null.

도움이 되었습니까?

해결책

Take Care of 2 things

  1. Your spring bean xml file and wink context xml should be in same contextconfigLocation

  2. Do not register your classes in Registrar bean setter.

You will be able to access properties from spring properties fine.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top