Max Kramer
06/10/2018, 1:28 PMLex Luthra
06/13/2018, 1:27 AMimport 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
}
}
Lex Luthra
06/13/2018, 1:28 AMapplication.yaml
would look like this:
foo:
json:
indentOutput: true
useNumericDates: false
webcrawler:
followRedirects: true
maxDepth: 1
userAgent: foo-webcrawler
maxDocumentSize: 4194304
requestTimeout: 30000