Java Spring Boot & Microservices | Java Spring Boot & Microservices Interview Questions Set - 1
Java Spring Boot & Microservices | Java Spring Boot & Microservices Interview Questions Set - 1
Q1.Why Profiles in spring boot.?
To deal with multiple environments in development of application, ideally each environment has separate configuration/property files like Dev, QA, Pre-Prod and Prod. Spring has provision of Profiles to make to use of configuration specific to environment.
Q2. How do we define Properties in Spring Boot.?
You can define properties into a file called application. roperties in a Spring Boot Application, you can create file manually or make use of Spring Initializer. If property files exist in class path by default spring boot loads the properties into an application.
Q3.What is Spring Boot Actuator.?
Actuator is mainly used to expose operational information about the running application like monitoring our application, gathering metrics, understanding traffic and the state of our database. Actuator brings production- grade tools to an application without explicit implementation.
Q4. How to enable Actuator in Spring boot application?
To enable the spring actuator feature, we need to add the dependency from Group Id: org.springframework.boot and Artifact Id: spring-boot-starter-actuator in pom.xml.
Q5. What is @SpringBootApplication Annotation in Spring Boot.?
@SpringBootAppication comes from the base package of org.springframework.boot.autoconfigure and the combination of @Configuration, @EnableAutoConfiguration, and @ComponentScan annotations with their default attributes.
Q6. How to change Embedded tomcat server in Spring Boot.?
Default Embedded tomcat server can be changed to any of Jetty, Undertow and Reactor servers by changing the default dependency to specific dependency in pom.xml and also by mentioning exclude option to particular dependency.
Q7. How to use Request Mapping and Get Mapping.?
Request Mapping can be used with GET, POST, PUT, and many other request methods using the method attribute on the annotation. Whereas Get Mapping is only an extension of Request Mapping which helps you to improve on performing the Get request.
Q8. What is the use of Spring Boot starters.?
Spring Boot starters are set of dependency descriptors can be added as dependencies to spring boot application and by default spring provides various starters which helps in rapid application development.
Q9. What is thyme leaf in Spring Boot.?
Thyme leaf is a server-side Java template engine for web applications which can integrate with spring framework by adding the spring-boot-starter-thymeleaf starter as dependency in pom file.
Q10. How to make use/available Custom Application Configuration in Spring Boot.?
Custom Application Configuration in Spring Boot by using the @Value annotation, but with this all the configuration values will be distributed throughout the application instead use @ConfigurationProperties by defining configuration component.