Thursday, 19 September 2013

How to resolve properties from property file in PreAuthorize?

How to resolve properties from property file in PreAuthorize?

In my test.properties file I have a key named devmode. Doing ${devmode}
inside @PreAuthorize fails.
@PreAuthorize("${devmode}")
How can I get the values of my properties inside a PreAuthorize?

I am loading the properties file like this:
<context:property-placeholder location="/WEB-INF/test.properties" />
Using the value inside <security:http use-expressions="true"> like this
works: <security:intercept-url pattern="/api/dev/**" access="${devmode}"
/>
This also works:
@Value(${devmode}) String myVar;
So I can't really see why it shouldn't work.

No comments:

Post a Comment