mardi 29 octobre 2019

Micronaut @Property value that is a list

How can I define some specific properties for testing that is a list not just a string?

The doc explains how to do with string, but I can't set the value to a list...

application.yml

items:
  - "Item 1"
  - "Item 2"

Test file:

@Test
@Property(name = "items", value = "Item 1")
fun justWithOneItem() {
    // ...
}

On the actual code, this works (as documented here)

Project file:

@Singleton
class SomeClass {
    @set:Inject
    @setparam:Property(name = "items")
    var items: List<String>? = null

    // ...
}

Thank you!

Aucun commentaire:

Enregistrer un commentaire