![]() ![]() ![]() Lastly, we also added a method annotated with This annotation essentially sends a signal to Spring to execute the annotated method after the dependency injection is finished. The reason is that in Kotlin, $ is a reserved character and used for string interpolation. If you are a Java developer, you might notice that the $ character is escaped \ here and wonder why. ![]() This tells Spring to inject the values that have the keys as store.name and store.address in the application.properties file to their respective fields. You can see that we put store.name and store.address as the value parameter for the annotation. So, we added two fields ( storeName and storeAddress) whose values are going to be injected from the application.properties via the annotation. KotlinspringvaluedemoApplication.kt - Field InjectionĪlright, let’s discuss what we have done here. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |