micronaut-projects / micronaut-spring

A collection of utilities for Spring users of Micronaut
Apache License 2.0
159 stars 46 forks source link

MicronautApplicationContext not inheriting parent propertySources #53

Open zyro23 opened 4 years ago

zyro23 commented 4 years ago

trying to use testcontainers boot autoconfig which relies on spring-cloud's bootstrap context. that gets registered as a parent context upstream of the micronaut context. but i am not able to resolve its properties from the application.

is the MicronautApplicationContext not supposed to merge the parent environment (i.e. inherit parent propertySources)?

ref.

graemerocher commented 4 years ago

Potentially, if you wish to send a PR for this, contributions welcome!

zyro23 commented 4 years ago

i started to give it a shot - see the referenced commit. but at that point, i hit java.lang.UnsupportedOperationException: Method parent not supported:

looks like there, a reverse propertySources merging impl. spring env. -> micronaut env. is needed which is not trivial - at least for me.

also, my original use-case was within a grails app. which means the app main context is supposed to inherit the micronaut context propertySources. it does not look like that is currently supported as well:

maybe GrailsApp can check if the parent micronaut context has another parent and if so, try merging its environment directly. but that would be a grails issue.

if this is going to stall without further contributions from my side, feel free to close as not-supported.
thanks for your feedback!