Skip to content
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

Spring Properties: Can't inject values using complex SpEL #19368

Closed
Sgitario opened this issue Aug 12, 2021 · 2 comments · Fixed by #19571
Closed

Spring Properties: Can't inject values using complex SpEL #19368

Sgitario opened this issue Aug 12, 2021 · 2 comments · Fixed by #19571
Labels
area/spring Issues relating to the Spring integration kind/bug Something isn't working
Milestone

Comments

@Sgitario
Copy link
Contributor

Describe the bug

Having this class:

@RestController
@RequestMapping("/values")
public class ValueController {

    @Value("${values.text}")
    String fieldUsingValue; // works

    @Value("${values.list}")
    String[] fieldUsingArray; // works

    @Value("#{'${values.list}'.split(',')}")
    List<String> fieldUsingList; // does not work

    @Value("#{${values.map}}")
    Map<String, String> fieldUsingMap; // does not work

   // ...
}

Note the SpEL expressions I checked and that according to the Spring documentation should work.
This is the application properties I'm using:

values.text=hello
values.list=A,B
values.map={key1: '1', key2: '2', key3: '3'}

Expected behavior

To be honest, I'm not sure how complex is to make the SpEL engine to work using the Quarkus configuration engine.
If this is too complex, I guess we should note this limitation in the Spring Properties guide.

Actual behavior

No response

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

No response

GraalVM version (if different from Java)

No response

Quarkus version or git rev

No response

Build tool (ie. output of mvnw --version or gradlew --version)

No response

Additional information

No response

@Sgitario Sgitario added the kind/bug Something isn't working label Aug 12, 2021
@quarkus-bot quarkus-bot bot added the area/spring Issues relating to the Spring integration label Aug 12, 2021
@quarkus-bot
Copy link

quarkus-bot bot commented Aug 12, 2021

/cc @geoand

@geoand
Copy link
Contributor

geoand commented Aug 12, 2021

Thanks for reporting, but this is not something we plan to support given the complexity involved in implementing it and the niche use case it addresses.

At best, we can print an error message mentioning this.

geoand added a commit to geoand/quarkus that referenced this issue Aug 23, 2021
geoand added a commit to geoand/quarkus that referenced this issue Aug 23, 2021
geoand added a commit that referenced this issue Aug 23, 2021
Fail at build time if SpEL is used in @value
@quarkus-bot quarkus-bot bot added this to the 2.3 - main milestone Aug 23, 2021
@gsmet gsmet modified the milestones: 2.3 - main, 2.2.0.Final Aug 23, 2021
gsmet pushed a commit to gsmet/quarkus that referenced this issue Aug 23, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/spring Issues relating to the Spring integration kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants