Spring-Boot-201 Flashcards
Do we require a parent tag in mvn while configuring the Boot ?
Yes with Mvn a tag is required
To which package all the boot dependncies fall on?
spring-boot-starters
How the Main class should be?
It should have annotated with @SpringBootApplication
Also provide the arg to SpringBootApplication.run in main method
What is mvnw
Maven wrapper, it is an automated building tool by spring boot
What goes in tag on pom.xml?
org.springframework.boot>
spring-boot-starter-parent>
What is a 12 factor app?
I. Codebase
One codebase tracked in revision control, many deploys
II. Dependencies
Explicitly declare and isolate dependencies
III. Config
Store config in the environment
IV. Backing services
Treat backing services as attached resources
V. Build, release, run
Strictly separate build and run stages
VI. Processes
Execute the app as one or more stateless processes
VII. Port binding
Export services via port binding
VIII. Concurrency
Scale out via the process model
IX. Disposability
Maximize robustness with fast startup and graceful shutdown
X. Dev/prod parity
Keep development, staging, and production as similar as possible
XI. Logs
Treat logs as event streams
XII. Admin processes
Run admin/management tasks as one-off processes
Can we have a yml prop also ?
Yes we can have yml also as prop
What is @SpringBootApplication composed of ?
@Confuguration, @ComponentScan, @EnableWebConfiguration
What does SprinBootaPPLICATION.RUN DOES
It gets to know which class is booting up
What is SpringApplicatioBuilder class?
Sometimes you require heirarchy or need multiple things to while booting up , this will help
new SpringApplicationBuilder(Main.cllass).child(otherconfig.class).run(args)
generally the weconfig goes to child part (like these)
How you can mute the logging info
new SpringApplicationBuilder(Main.class).logStraytupInfo(false).run(args);
How we can have profiles
With the same SpringApplicationBuilder use .profiles
How can we add listeners
Yes .listener and then impl the Interface like ApplicationEvent
How can we deliberately stop spring assuming the AutoConfiguration?
There are .operators like to SBApp class like : .web(WebApplicationType.NONE)
What @Order will do ?
If you want to execute the Main in certain order
How can we provide the prop files to Main
We can use Or @PropertySource, use default application.prop or applicaion.yml and place it in classpath
Yes Env variable can be used also