Skip to content

UNIFORM #29582

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

Closed
qxo opened this issue Jan 27, 2022 · 2 comments
Closed

UNIFORM #29582

qxo opened this issue Jan 27, 2022 · 2 comments
Labels
status: invalid An issue that we don't feel is valid

Comments

@qxo
Copy link
Contributor

qxo commented Jan 27, 2022

@Configuration
@ConfigurationProperties("app")
public class AppConfig implements InitializingBean {

    private Map<String, String> mapping;

    public Map<String, String> getMapping() {
        return mapping;
    }

    public void setMapping(Map<String, String> mapping) {
        this.mapping = mapping;
    }

app:
  mapping:
    /AAA/*1: "/*AAAAAAAAAAA*/"

===> why "/AAA/*1" ==> AAA ?

@spring-projects-issues spring-projects-issues added the status: waiting-for-triage An issue we've not yet triaged label Jan 27, 2022
@mbhave
Copy link
Contributor

mbhave commented Jan 27, 2022

It sounds like you're asking why binding a map key with special characters doesn't contain the actual value. Please see this section of the docs to see what needs to be done when binding to a map with special characters in the key.

@mbhave mbhave added status: invalid An issue that we don't feel is valid and removed status: waiting-for-triage An issue we've not yet triaged labels Jan 27, 2022
@qxo
Copy link
Contributor Author

qxo commented Jan 27, 2022

It sounds like you're asking why binding a map key with special characters doesn't contain the actual value. Please see this section of the docs to see what needs to be done when binding to a map with special characters in the key.

Thanks, It's worked for me:)

app:
  mapping:
    "[/AAA/*1]": "/*AAAAAAAAAAA*/"
    "[/key2]": "value2"

@bclozel bclozel closed this as completed Jan 27, 2022
quaff added a commit to quaff/spring-boot that referenced this issue Oct 28, 2024
Given:
```yaml
my:
  map:
    "/key": "value"
```
---
Before this commit:
It's equivalent to
```yaml
my:
  map:
    "[key]": "value" # "[/key]" is expected
```
Such counter-intuitive behavior will confuse developers, there are several reported issues, incomplete list: spring-projectsGH-41099 spring-projectsGH-29582 spring-projectsGH-24548

---
After this commit:
```
***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under 'my.map' to java.util.Map<java.lang.String, java.lang.String>:

    Reason: java.lang.IllegalArgumentException: Please rewrite key '/key' to '[/key]' and surround it with quotes if YAML is using

Action:

Update your application's configuration

```
---

See spring-projectsGH-42802
quaff added a commit to quaff/spring-boot that referenced this issue Oct 28, 2024
Given:
```yaml
my:
  map:
    "/key": "value"
```
---
Before this commit:
It's equivalent to
```yaml
my:
  map:
    "[key]": "value" # "[/key]" is expected
```
Such counter-intuitive behavior will confuse developers, there are several reported issues, incomplete list: spring-projectsGH-41099 spring-projectsGH-29582 spring-projectsGH-24548

---
After this commit:
```
***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under 'my.map' to java.util.Map<java.lang.String, java.lang.String>:

    Reason: java.lang.IllegalArgumentException: Please rewrite key '/key' to '[/key]' and surround it with quotes if YAML is using

Action:

Update your application's configuration

```
---

See spring-projectsGH-42802
quaff added a commit to quaff/spring-boot that referenced this issue Oct 28, 2024
Given:
```yaml
my:
  map:
    "/key": "value"
```
---
Before this commit:
It's equivalent to
```yaml
my:
  map:
    "[key]": "value" # "[/key]" is expected
```
Such counter-intuitive behavior will confuse developers, there are several reported issues, incomplete list: spring-projectsGH-41099 spring-projectsGH-29582 spring-projectsGH-24548

---
After this commit:
```
***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under 'my.map' to java.util.Map<java.lang.String, java.lang.String>:

    Reason: java.lang.IllegalArgumentException: Please rewrite key '/key' to '[/key]' and surround it with quotes if YAML is using

Action:

Update your application's configuration

```
---

See spring-projectsGH-42802
quaff added a commit to quaff/spring-boot that referenced this issue Oct 28, 2024
Given:
```yaml
my:
  map:
    "/key": "value"
```
---
Before this commit:
It's equivalent to
```yaml
my:
  map:
    "[key]": "value" # "[/key]" is expected
```
Such counter-intuitive behavior will confuse developers, there are several reported issues, incomplete list: spring-projectsGH-41099 spring-projectsGH-29582 spring-projectsGH-24548

---
After this commit:
```
***************************
APPLICATION FAILED TO START
***************************

Description:

Failed to bind properties under 'my.map' to java.util.Map<java.lang.String, java.lang.String>:

    Reason: java.lang.IllegalArgumentException: Please rewrite key '/key' to '[/key]' and surround it with quotes if YAML is using

Action:

Update your application's configuration

```
---

See spring-projectsGH-42802
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: invalid An issue that we don't feel is valid
Projects
None yet
Development

No branches or pull requests

4 participants