Skip to content
This repository has been archived by the owner on Jul 13, 2022. It is now read-only.

Properties/YAML Editors and Map Keys #292

Open
garyrussell opened this issue Jun 22, 2018 · 8 comments
Open

Properties/YAML Editors and Map Keys #292

garyrussell opened this issue Jun 22, 2018 · 8 comments

Comments

@garyrussell
Copy link

See spring-projects/spring-boot#13555

This syntax is allowed:

logging.level.[org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer]=info

and is required when the logger is for an innner class (contains $).

However, STS flags this as invalid syntax

screen shot 2018-06-22 at 12 23 24 pm

Also, similar keys in YAML are indicated in black:

screen shot 2018-06-22 at 12 24 21 pm

@kdvolder
Copy link
Contributor

I think you can just write:

logging.level.org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer=info

Or doesn't that work?

@kdvolder
Copy link
Contributor

BTW: I think if you are going to use the '[]' notation, which is kind of logical here, I aggree, I think you probably shouldn't add the extra '.'. So like this:

logging.level[org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer]=info

But I checked and STS also doesn't 'approve' of that notation.

I think it is because we are assuming the notation with '[]' is meant for indexing with numbers inside of 'array-like' constructs. If that was ever really the way it worked (?), at least it looks like this is no longer really the case, so this is definitely a bug we should fix.

@garyrussell
Copy link
Author

Unfortunately, no; Boot strips out the $ - see the referenced Boot issue.

@garyrussell
Copy link
Author

Looks like [...] indicates an index or a map key

 * <p>
 * The "{@code [}" and "{@code ]}" characters may be used to indicate an associative
 * index(i.e. a {@link Map} key or a {@link Collection} index. Indexes names are not
 * restricted and are considered case-sensitive.

@garyrussell
Copy link
Author

garyrussell commented Jun 22, 2018

I just tested it and boot doesn't care whether or not there is a dot before the [..

logging:
  level:
    org.springframework.kafka.listener[KafkaMessageListenerContainer$ListenerConsumer]: info

works too.

and this

logging.level[org.springframework.kafka.listener.KafkaMessageListenerContainer$ListenerConsumer]: info

@kdvolder
Copy link
Contributor

The STS 'parser' for these '.' and '[]' things probably does care... If I remember correctly. So that's another bug.

@garyrussell
Copy link
Author

I've asked on the boot doco issue: spring-projects/spring-boot#13506 (comment)

@garyrussell
Copy link
Author

The boot team confirmed that both syntaxes are supported (with/without . before [).

@martinlippert martinlippert added this to the 3.9.6.RELEASE GA milestone Jun 25, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

3 participants