Hi, I was wondering if anybody would be able to he...
# spring
m
Hi, I was wondering if anybody would be able to help with https://kotlinlang.slack.com/archives/C0B8RC352/p1528479490000152
l
I was able to use this:
Copy code
import org.springframework.boot.context.properties.ConfigurationProperties
import javax.inject.Named
import javax.validation.*

@Named
@ConfigurationProperties("foo")
class FooProperties {

    @Valid
    val json = Json()

    @Valid
    val webCrawler = WebCrawler()

    class Json {
        var indentOutput = true
        var useNumericDates = false
    }

    class WebCrawler {
        @NotBlank
        lateinit var userAgent: String

        var maxDepth = 1

        @Min(0)
        @Max(10 * 1024 * 1024)
        var maxDocumentSize: Int = 1024 * 1024

        @Min(0)
        @Max(15 * 60000)
        var requestTimeout: Int = 30000

        var followRedirects = true
    }
}
application.yaml
would look like this:
Copy code
foo:
  json:
    indentOutput: true
    useNumericDates: false
  webcrawler:
    followRedirects: true
    maxDepth: 1
    userAgent: foo-webcrawler
    maxDocumentSize: 4194304
    requestTimeout: 30000