Filipe Freire
Filipe Freire

Reputation: 833

Is an empty entry in configuration loaded as null for a Resource Map in Spring?

If I have a configuration file (yml or properties) and I have a blank entry like the one below:

some.entry =

When I load that entry as a @Resource of a given bean, like this:

@Resource(name = "someEntry")
Map<String, List<String>> someMap;

Will the someMap end up as null or an empty Map?

And would the behavior be different if instead of @Resource a similar approach with @Value is used?

Upvotes: 0

Views: 652

Answers (1)

Pedro Tavares
Pedro Tavares

Reputation: 1149

Both @Resource and @Value will convert some.entry = to null.

Upvotes: 1

Related Questions