-
Notifications
You must be signed in to change notification settings - Fork 38.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot use SpEL expression to inject an array into @CrossOrigin's value attribute #24982
Comments
Yes, it is possible to inject an array into a field or constructor/method argument using The reason for the latter is that each individual Lines 463 to 471 in 0a9c768
The concrete implementation Now, if you knew exactly how many elements were in the array -- for example always two -- you could do something like the following. @CrossOrigin({"#{'${myOrigins}'.split(',')[0]}", "#{'${myOrigins}'.split(',')[1]}"}) But that is obviously not a robust solution. Similarly, with the In summary, it is not currently possible to supply a SpEL expression via |
As of 5.3 we support origin patterns and I'm wondering if that helps in this case. If not, I think we should be able to treat the input as a "," separated string. |
thanks, will try new version in the future |
I'm facing the same issue that am not able to inject a list of strings into origins parameter of @crossorigin. Can anyone help me how to inject list of allowed hosts from application.properties ? |
I'll close this as superseded by #27606. Any further discussion can go on there. |
Affects: \5.2.2
we usually inject an array use comma like this:
key=A,B,C
but can't inject an array like below
origin=http://domainA.com,http://domainB.com
only key have one element, below SpEL can work fine, if key have more than 2 elements, it won't work
Or
Can provide any advice?
The text was updated successfully, but these errors were encountered: