Spring Boot Interview Questions For 5+ Years Experience
Spring Boot Interview Questions For 5+ Years Experience
Step 1 -
The first step to connect the database like Oracle or MySql is adding the dependency for your database
connector to pom.xml.
Step 2 -
Step 3 -
Step 4 -
The next step is configuring of the database by using Configure application.properties to connect to your
database.
Step 5-
And the last step is to restart your device and your connection is ready to use.
You can create a JS file for sending an alert by creating a custom file named custom.js in
/src/main/resources/static/js/ directory with below code
alert("I'm active");
Q.How can you enable auto reload of application with Spring Boot?
You can enable auto-reload/LiveReload of spring boot application by adding the spring-boot-
devtools dependency in the pom.xml file.
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<optional>true
</dependency>
Note: please restart your application for immediate effects.
Q.What is the reason to have a spring-boot-maven module?
The reason behind to have Spring-boot-maven module is it gives a couple of charges which empower you to
package the code as a container or run the application
The Spring Initializer is a web application that can produce a Spring Boot project structure for you. It doesn’t
create any application code. However, it will give you an essential project structure and either a Maven or a
Gradle build specification to fabricate your code with. You should simply compose the application code.
An online interface.
Via Spring Tool Suite.
Using the Spring Boot CL
Example:-
return factory;
Example:-
@Bean public ConfigurableServletWebServerFactory tomcatCustomizer() {
return factory;
logging.level.org.springframework.web: DEBUG
logging.level.org.hibernate: ERROR
You can create a custom configuration for a MySQL data source in spring boot as
@Configuration
public class MySQLAutoconfiguration {
//...
The starter POMs are helpful reliance descriptors that can be added to your application’s Maven. In another
word, if you are building up a project that utilizes Spring Batch for batch preparing, you need to incorporate
spring-boot-starter-bunch that will import all the required conditions for the Spring Batch application. This
decreases the burden of looking at and designing all of the conditions required for a structure.