Reputation: 442
I'm trying to enabled or disabled authorization through property file. But following is not working
<global-method-security pre-post-annotations="${enabled}" />
Failing xml validation
Multiple annotations found at this line: - cvc-enumeration-valid: Value '${enabled}' is not facet-valid with respect to enumeration '[disabled, enabled]'. It must be a value from the enumeration.
Can some one suggest me correct way of doing this ?
Upvotes: 0
Views: 753
Reputation: 1043
Unfortunately the Spring Security XSDs hard-code the possible values for that (and other) attributes IIRC:
<xs:attributeGroup name="global-method-security.attlist">
<xs:attribute name="pre-post-annotations">
<xs:annotation>
<xs:documentation>Specifies whether the use of Spring Security's pre and post invocation annotations
(@PreFilter, @PreAuthorize, @PostFilter, @PostAuthorize) should be enabled for this
application context. Defaults to "disabled".
</xs:documentation>
</xs:annotation>
<xs:simpleType>
<xs:restriction base="xs:token">
<xs:enumeration value="disabled"/>
<xs:enumeration value="enabled"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
...
So property replacement is not possible if you want XML validation to succeed (because XML validation has no knowledge of Spring's replacement tokens).
Upvotes: 2