2

My application has array environment variables in the form tableName[0]=tableName ... property.one.two.tableName[x]=tableNameX

When running locally, everything works fine when I put the properties in application.properties, command-line args, or environment variables. However, once I try and deploy to marathon, the array variables no longer work. I am trying to pass them in the env property in the marathon json array. I've tried:

"env": {
"property.one.two.tableName[0]":"tableName",
....
}

and

"env": {
"property.one.two.tableName": ["tableName", ... ]
 ...
}

and

"env" {
"tableName": [
 {"property.one.two.tableName[0]" : "tableName"}
 {....}
]
}

But nothing has worked. Has anyone gotten this to work?

aarbor
  • 1,398
  • 1
  • 9
  • 24
  • Without more details concerning your app it's impossible to help, I'm afraid. The first version you have there *should* work so unsure what's the issue here. You could try with the `simpleservice` in https://gist.github.com/mhausenblas/7aba37703f9669576b00e973ae6a50c8 and see if you can pass env variables there, and if so then it's likely an issue with how the Spring conterization has been carried out. – Michael Hausenblas Nov 22 '16 at 19:00
  • It actually turns out to be a Spring bug I think. My example was slightly inaccurate in that i only had 1 "level" of properties. The real properties are `property.one.two.three[x]` and spring's relaxed binding was not working. Setting the environment variable to the exact spelling of the expected variable solved the issue. – aarbor Nov 22 '16 at 20:54
  • Nice. Suggest you answer the question then yourself in order to make it official ;) – Michael Hausenblas Nov 22 '16 at 21:06

1 Answers1

2

Seems to be a bug with Spring. Spring's relaxed binding was not working. Setting the environment variable to the exact spelling of the expected variable solved the issue.

In my existing code, relaxed binding was working for property.one.two but stopped working for property.one.two.three

aarbor
  • 1,398
  • 1
  • 9
  • 24