• +91 9723535972
  • info@interviewmaterial.com

Spring Interview Questions and Answers

Spring Interview Questions and Answers

Question - 71 : - What are the limitations of autowiring?

Answer - 71 : -

Overriding possibility: Dependencies are specified using and   settings that override autowiring.
Data types restriction: Primitive data types, Strings, and Classes can’t be autowired.

Question - 72 : - What do you understand by the term ‘Spring Boot’?

Answer - 72 : -

Spring Boot is an open-source, java-based framework that provides support for Rapid Application Development and gives a platform for developing stand-alone and production-ready spring applications with a need for very few configurations.

Question - 73 : - Explain the advantages of using Spring Boot for application development.

Answer - 73 : -

  • Spring Boot helps to create stand-alone applications which can be started using java.jar (Doesn’t require configuring WAR files).
  • Spring Boot also offers pinpointed ‘started’ POMs to Maven configuration.
  • Has provision to embed Undertow, Tomcat, Jetty, or other web servers directly.
  • Auto-Configuration: Provides a way to automatically configure an application based on the dependencies present on the classpath.
  • Spring Boot was developed with the intention of lessening the lines of code.
  • It offers production-ready support like monitoring and apps developed using spring boot are easier to launch.

Question - 74 : - Differentiate between Spring and Spring Boot.

Answer - 74 : -

  • The Spring Framework provides multiple features like dependency injection, data binding, aspect-oriented programming (AOP), data access, and many more that help easier development of web applications whereas Spring Boot helps in easier usage of the Spring Framework by simplifying or managing various loosely coupled blocks of Spring which are tedious and have a potential of becoming messy.
  • Spring boot simplifies commonly used spring dependencies and runs applications straight from a command line. It also doesn’t require an application container and it helps in monitoring several components and configures them externally.

Question - 75 : - What are the effects of running Spring Boot Application as “Java Application”?

Answer - 75 : -

The application automatically launches the tomcat server as soon as it sees that we are running a web application.

Question - 76 : - What is Spring Boot dependency management system?

Answer - 76 : -

It is basically used to manage dependencies and configuration automatically without the need of specifying the version for any of that dependencies.

Question - 77 : - What are the possible sources of external configuration?

Answer - 77 : -

Spring Boot allows the developers to run the same application in different environments by making use of its feature of external configuration. This uses environment variables, properties files, command-line arguments, YAML files, and system properties to mention the required configuration properties for its corresponding environments. Following are the sources of external configuration:
  • Command-line properties – Spring Boot provides support for command-line arguments and converts these arguments to properties and then adds them to the set of environment properties.
  • Application Properties – By default, Spring Boot searches for the application properties file or its YAML file in the current directory of the application, classpath root, or config directory to load the properties.
  • Profile-specific properties – Properties are loaded from the application-{profile}.properties file or its YAML file. This file resides in the same location as that of the non-specific property files and the {profile} placeholder refers to an active profile or an environment.

Question - 78 : - Can we change the default port of the embedded Tomcat server in Spring boot?

Answer - 78 : -

  • Yes, we can change it by using the application properties file by adding a property of server.port and assigning it to any port you wish to.
  • For example, if you want the port to be 8081, then you have to mention server.port=8081. Once the port number is mentioned, the application properties file will be automatically loaded by Spring Boot and the specified configurations will be applied to the application.

Question - 79 : - Can you tell how to exclude any package without using the basePackages filter?

Answer - 79 : -

We can use the exclude attribute while using the annotation @SpringBootApplication as follows: 

  • @SpringBootApplication(exclude= {Student.class})
  • public class InterviewBitAppConfiguration {}

Question - 80 : - Can the default web server in the Spring Boot application be disabled?

Answer - 80 : -

Yes! application.properties is used to configure the web application type, by mentioning spring.main.web-application-type=none.


NCERT Solutions

 

Share your email for latest updates

Name:
Email:

Our partners