Category Archives: Interview Questions

Jenkins interview questions

Questions on Jenkins

Recently many interview has questions on Jenkins. Jenkins being a famous open source automation server. Here are few frequently asked Jenkins interview questions with answers.

  • What is Jenkins software?

Jenkins is self-contained, open source automation server used to automate all sorts of tasks related to building, testing, and delivering or deploying software.

Jenkins is one of the leading open source automation servers available. Jenkins has an extensible, plugin-based architecture, enabling developers to create 1,400+ plugins to adapt it to a multitude of build, test and deployment technology integrations.

  • What is the minimum JRE required to run jenkins 2.1?

JDK 8 or JRE 8

  • What is a Jenkins Pipeline?

Jenkins Pipeline (or simply “Pipeline”) is a suite of plugins which supports implementing and integrating continuous delivery pipelines into Jenkins.

  • What is continuous delivery pipeline?

A continuous delivery pipeline is an automated expression of your process for getting software from version control right through to your users and customers.

  • What is an agent in jenkins ?

The agent directive tells Jenkins where and how to execute the Pipeline, or subset thereof. As you might expect, the agent is required for all Pipelines.

  • What is post section in jenkins?

The post section of a Pipeline is guaranteed to run at the end of a Pipeline’s execution. In order to that we can add some notification or other steps to perform finalization,notification, or other end-of-Pipeline tasks.

  • What is the use of Jenkins in Devops?

Jenkins automate the CI / CD process in Devops layer.

  • Which is the best continuous integration tool?

1. Jenkins, Teamcity etc…

  • What is CI and CD process?

Continuous integration
Developers practicing continuous integration merge their changes back to the main branch as often as possible

Continuous delivery
Continuous delivery is an extension of continuous integration to make sure that you can release new changes to your customers quickly in a sustainable way.

  • What is a Jenkinsfile?

Jenkinsfile is a text file containing the definition of a Jenkins Pipeline and checks into source control.

  • What is an SCM in Jenkins?

Source code management in jenkins is the first step in jenkins to download latest source code from git or svn etc, to start the build process.

The above advanced java interview questions or java architecture questions are given above.

Learn

Spring boot interview questions.

Questions on Spring Boot – Part 3

Part 1  | Part 2 | Part 3

Questions on spring Boot

Recently many interview has a set of questions on Spring Boot when it comes to advanced Java Interviews. Here are frequently asked Spring Boot questions with answers.

  • What is Hot swapping in spring boot?

Reloading the changes without restarting the server is called hot swapping, Modern IDEs (Eclipse, IDEA, etc.) all support hot swapping of bytecode,  so if you make a change that doesn’t affect class or method signatures it should reload cleanly with no side effects.

  • How do you Switch off the Spring Boot security configuration?

If you define a @Configuration with @EnableWebSecurity anywhere in your application it will switch off the default webapp security settings in Spring Boot.

  • How to execute Spring Batch jobs on startup?

Spring Batch auto-configuration is enabled by adding @EnableBatchProcessing (from Spring Batch) somewhere in your context. By default it executes all Jobs in the application context on startup

  • Does spring boot need Logging? What is the default one?

Spring Boot has no mandatory logging dependency, except for the Commons Logging API.

  • How do you configure Configure Logback for logging?

If you put a logback.xml in the root of your classpath it will be picked up from there

  • How do you Configure Log4j for logging?

Spring Boot supports Log4j 2 for logging configuration if it is on the classpath. If you are using the starters for assembling dependencies that means you have to exclude Logback and then include log4j 2 instead

  • How do you write a Write a JSON REST service in spring boot?

Any Spring @RestController in a Spring Boot application should render JSON response by default as long as Jackson2 is on the classpath

  • How do you Write an XML REST service in spring boot?

If you have the Jackson XML extension (jackson-dataformat-xml) on the classpath, it will be used to render XML responses

  • What is the default Multipart File Uploads size in spring boot?

By default Spring Boot configures Spring MVC with a maximum file of 1MB per file and a maximum of 10MB of file data in a single request.

  • How do you Enable HTTP response compression in spring boot?

HTTP response compression is supported by Jetty, Tomcat, and Undertow. It can be enabled by adding server.compression.enabled=true in application.properties

  • How do you add Add a Servlet, Filter or Listener to an application ?

There are two ways to add Servlet, Filter, ServletContextListener and the other listeners supported by the Servlet spec to your application. You can either provide Spring beans for them, or enable scanning for Servlet components.

Questions on Spring boot- Part 1
Questions on Spring boot- Part 2
Questions on Spring boot- Part 3

Spring Boot Questions- Part 2

 Part 1  | Part 2 | Part 3

Spring boot Questions

Recently many interview has a set of questions on Spring Boot when it comes to advanced Java Interviews. Here are frequently asked Spring Boot questions with answers.

  • What is LiveReload?

The spring-boot-devtools module includes an embedded LiveReload server that can be used to trigger a browser refresh when a resource is changed. LiveReload browser extensions are freely available for Chrome, Firefox and Safari from livereload.com.

Read More spring boot devtools 

  • How to exclude auto restart for static files?

By default changing resources in /META-INF/maven, /META-INF/resources, /resources, /static, /public or /templates will not trigger a restart
But If you want to customize these exclusions you can use the spring.devtools.restart.exclude property
if you want to keep those defaults and add additional exclusions, use the spring.devtools.restart.additional-exclude property instead

Read More spring boot devtools

  • How to start spring boot application in debug mode?

java -jar myproject-0.0.1-SNAPSHOT.jar –debug

  • What are the advantages of YAML file than Properties file?

YAML is a superset of JSON, and as such is a very convenient format for specifying hierarchical configuration data. The SpringApplication class will automatically support YAML as an alternative to properties whenever you have the SnakeYAML library on your classpath.

  • What are the different ways to load YAML file in Spring boot?

1. YamlPropertiesFactoryBean will load YAML as Properties
2. YamlMapFactoryBean will load YAML as a Map

  • What are the advantages of spring Externalized Configuration?

Externalize your configuration to work with the same application code in different environments. You can use properties files, YAML files, environment variables and command-line arguments to externalize configuration.

  • How to write custom log configuration in spring boot?

You can force Spring Boot to use a particular logging system using the org.springframework.boot.logging.LoggingSystem system property. The value should be the fully-qualified class name of a LoggingSystem implementation. You can also disable Spring Boot’s logging configuration entirely by using a value of none.

  • How do you customize Favicon in spring boot web application?

Spring Boot looks for a favicon.ico in the configured static content locations and the root of the classpath (in that order). If such file is present, it is automatically used as the favicon of the application.

  • How spring boot handles error in application?

Spring Boot provides an /error mapping by default that handles all errors in a sensible way, and it is registered as a ‘global’ error page in the servlet container.

  • How do you Create a deployable war file in spring boot?

Step1: Extend SpringBootServletInitializer and override its configure method
Step 2: Change packing type to war in pom.xml or in build.gradle
Step 3: Mark the embedded servlet container dependency as provided

Read More spring boot war example

Spring Boot Questions- Part 1
Spring Boot Questions- Part 2
Spring Boot Questions – Part 3

Spring Boot Interview Questions- Part 1

Part 1  | Part 2 | Part 3

Spring interview questions and answer

Nowadays many interview has a set of questions on Spring when it comes to advanced Java Interviews. Here are frequently asked Spring Boot Interview questions with answers.

  • What is Spring Boot?

Spring Boot makes it easy to create stand-alone, production-grade Spring based Applications that you can “just run”.
You can use Spring Boot to create Java applications that can be started using java -jar or more traditional war deployments.

  • What are the advantages of spring boot application?

Provide a range of non-functional features that are common to large classes of projects (e.g. embedded servers, security, metrics, health checks, externalized configuration).
Opinionated view of the Spring platform and third-party libraries so you can get started with minimum fuss.
Absolutely no code generation and no requirement for XML configuration.
Provide a radically faster and widely accessible getting started experience for all Spring development.

  • What are the requirements of Spring boot System?

Spring Boot 1.5.9.RELEASE requires
Java 7 +
Spring 4.3.13 +

For build support
Maven 3.2+
Gradle 2.9+

Container Support
Tomcat 7+
Jetty 8+ (Jetty 9.3 requires JDK 8 +)

Read more Spring boot system requirements

What is the latest version of spring boot and its System requirement?

As per July 2018 Spring boot latest version is 2.1.

Spring boot needs Java 8+ version and Spring 5 framework as minimum version.

Gradle 4 + version

  • Spring boot 2 new features?

Refer : Spring boot 2 new features

  • What are the use of @EnableAutoConfiguration annotation?

This annotation tells Spring Boot to “guess” how you will want to configure Spring, based on the jar dependencies that you have added.

Read more @enableautoconfiguration spring boot example

  • What is Spring Boot Starter?

Spring Boot provides a number of “Starters” that make easy to manage dependencies for your project.

Read More Spring boot starter

  • What is spring-boot-starter-parent?

The spring-boot-starter-parent is a special starter that makes Maven or Gradle dependency-management easier by adding jars to your classpath.

Read More spring-boot-starter-parent

  • What is spring-boot-starter-web?

This starter will add Tomcat and Spring MVC dependency to our application and its default configuration.

Read More spring-boot-starter-web

  • How to create an executable jar using spring boot?

Add this below plugin to pom.xml

<build>
    <plugins>
        <plugin>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-maven-plugin</artifactId>
        </plugin>
    </plugins>
</build>

Use mvn clean package to create executable jar file

Read More spring boot executable jar example

  • How do you run and stop spring boot executable jar?

Open cmd or shell window and use java -jar as shown below

$ java -jar myproject-0.0.1-SNAPSHOT.jar

To stop use ctrl+C

Read More run spring boot jar from command line

  • How do you change JDK version in spring boot?

Java 1.6 as the default compiler level.
You can overwrite it by adding java.version property tag as shown below

<properties>
    <java.version>1.8</java.version>
</properties>
  • What is the use of @SpringBootApplication annotation?

The @SpringBootApplication annotation is equivalent to using @Configuration, @EnableAutoConfiguration and @ComponentScan with their default attributes

Since many spring Boot developers have their main class annotated with @Configuration, @EnableAutoConfiguration and @ComponentScan, spring boot provides you a new annotation @SpringBootApplication as replacement.

  • What is spring-boot-devtools ?

Applications that use spring-boot-devtools will automatically restart whenever files on the classpath change. This can be a useful feature when working in an IDE as it gives a very fast feedback loop for code changes.

  • What are Profiles in spring boot?

Spring Profiles provide a way to segregate parts of your application configuration and make it only available in certain environments. Any @Component or @Configuration can be marked with @Profile to limit when it is loaded

  • Spring Boot Actuator?

Spring Boot Actuator help you monitor and manage your application health when you push it to production.
You can choose to manage and monitor your application by using HTTP endpoints.

  • How do you Change tomcat or jetty HTTP port?

You can change the tomcat http port by changing default http property in application.properties file.

  • How to disable specific auto-configuration in spring boot?

You can use exclude property as shown below to disable specific auto configuration

@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})

 

Spring boot interview questions- Part 1
Spring boot interview questions- Part 2
Spring boot interview questions- Part 3