- <scope> provided </scope>. in dependency means this is only for dependency
Eg: Lombok is a compile-only tool, so that we used to provide a scope here for this dependency.
- <scope>test </scope> in depdency section is only test.
- spring boot MAVEN Plugin to create a runnable jar automatically for our microservice.
- To read applicatoin.properties from a class
- We will add @ConfiguratoinProperties annotation on the class by adding prefix with value
- Ex: You have application.yaml in module/resources folder
- There you provided as
twitter-keywords:
- Java
- Microservices
- Spring
- Kafka
- In the class where we want to read the properties file we define as below in class
Then as a private list of string, with name twitterKeywords here.
The naming is important, and this should match to the definition and the application YAML file
Note that for twitter-keywords, we use twitterKeywords with capital, "K" so for replacement of. "-K" we use "Capital K".
- To make that class as a Spring Bean, we will add @Configuration Annotation.
We will also use @Data annotation from Lombok here to obtain methods like getter, setter , hashcode and toString to get rid of some boilerplate JAVA codes.
So what Lombok does is to create some code like getter setter methods and then update the class with these methods.
No comments:
Post a Comment