Created
December 1, 2020 00:46
-
-
Save billydh/8d540dccfd5b4782be51001fe759df87 to your computer and use it in GitHub Desktop.
with constructor injection
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.thecodebrews.kotlinspringvaluedemo | |
import org.springframework.beans.factory.annotation.Value | |
import org.springframework.stereotype.Component | |
import javax.annotation.PostConstruct | |
@Component | |
class StoreConfiguration( | |
@Value("\${store.no-of-customers-capacity}") val capacity: Int | |
) { | |
@Value("\${store.size-in-meter-square}") | |
val size: Int = 0 | |
@PostConstruct | |
fun getStoreConfiguration() { | |
print("Store size is $size meter square\n") | |
print("Store max capacity is $capacity customers\n") | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment