tags:

views:

104

answers:

0

Hi

First: I'm using Spring 3.0

I have a problem when configuring my controller class. The controller uses a web service which I want to define the endpoint address using a .properties file.

@Controller
public class SupportController {

    @Value("#{url.webservice}") 
    private String wsEndpoint;

    ...

In my application context xml-file, I've defined this:

<context:property-placeholder location="/WEB-INF/*.properties" />

I've been reading the documentation, trying different approaches (like adding prefix systemProperties.),but I keep getting an error message telling me that it doesn't exist.

Field or property 'url' cannot be found on object of type 'org.springframework.beans.factory.config.BeanExpressionContext'


Ok. I've figured it out.

Now, in the controller:

@Value("#{settings['url.webservice']")

Then in the context configuration I have this "helper bean":

<util:properties id="settings" 
location="/WEB-INF/supportweb.properties"></util:properties>