0% found this document useful (0 votes)
3 views

SpringBoot

The document outlines key features and concepts of Spring Boot, including its advantages like removing XML configuration and providing cloud support. It explains components such as Spring Boot's parent class, built-in databases, CommandLineRunner, Spring Data JPA, and various annotations for configuration and security. Additionally, it discusses tools like Actuator, Spring Boot DevTools, and database migration tools like Flyway and Liquibase.

Uploaded by

indhu jayan
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

SpringBoot

The document outlines key features and concepts of Spring Boot, including its advantages like removing XML configuration and providing cloud support. It explains components such as Spring Boot's parent class, built-in databases, CommandLineRunner, Spring Data JPA, and various annotations for configuration and security. Additionally, it discusses tools like Actuator, Spring Boot DevTools, and database migration tools like Flyway and Liquibase.

Uploaded by

indhu jayan
Copyright
© © All Rights Reserved
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 6

1).Why Spring Boot?

Removing XML and provide Annotations

Standardization for Microservices

Integrated Server for Development

Cloud Support

Adapt & Support for 3rd Party Library

2).What is Spring Boot?

Spring Boot=Spring framework-XML Configuration+Integrated Server

3).What is parent class in SpringBoot Application?

Spring-boot-starter-parent

4).Examples of in built databases

Apache Derby

H2 DB

HSQLDB

5).What is CommandLineRunner

To start our application without main method

6).what is @SpringBootApplication?

Starting point of Spring Boot Application

7).Waht is Sping Data JPA?

It is a part of Spring Data Family,aims to provide JPA basedd repositories that aims to simplify the
implementation of data access layer using JPA.

8).what are sub interfaces in Repository Interface

CrudRepository

PagingAndSortingRepository

JpaRepository

9).What is difference between JPARepository and CrudRepository?


->Identify Repository DAO

10).how to create Custom queries?

Creating queries using methodnames

@Query

@NamedQuery

11).How to create Jar/war in spring Boot

by configuring spring-boot-maven-plugin in pom.xml file

-->ConfigurationApplicationContext applicationContext=
SpringApplication.run(UserDefinedClass.class,args);

applicationContext.getBean("userDefinedClass",UserDefinedClass.class);

12).@Modifing(clearAutomatically=true) Annotation?

EntityManager need to flush all the changes into DB we need to configure @Modifing

13).What is Actuator?

If we need to know about our application properties like loggers,endpoints we need to add
spring-boot-starter-actuator jar in pom file

we can access info,health from browser.

https://localhost:8090/health

We have 2 types of actuators

1.sensitive and Insensitive

We we need to access sensitive info we need to add below property in application.properties file

management.security.enabled=false

14).How to Change actuator port number?

management.port=9999

15).what is spring-boot-starter-security

if we need to access sensitive information with username and passwords we need to


configure this in pom file

management.security.enabled=true
security.basic.enabled=true

security.user.name=admin

security.user.password=root

16).why we need Spring-boot-devtools?

If we modified any changes in code,If we want to restart automatically we need to add spring-
boot-devtool.jar in pom.xml

17).How to configure Loggers in Spring boot?

Spring Boot have inbuilt Logger support

private static final Logger

in properties file,we can customize loggers

logging.level.root=debug;

logging.path=logs

18).what is Profiles?

Profiles are used to do configuration based on environment wise in application.properties file

eg:-

application.properties

application-dev.properties

application-prod.properties

eg:

@service

@Profile("dev")

class DevProfileBean implements EnvBasedCofig{

@Override

public void setup(){ }

}
spring.profiles.active=prod

19).what is CommandLineRunner Interface and ApplicationRunner Interface?

Both of them provides the same functionality and the only difference between
CommandLineRunner and ApplicationRunner is CommandLineRunner.run() accepts String
array[] whereas ApplicationRunner.run() accepts ApplicationArguments as argument.

20).How to set Default Properties in Spring Boot?

Map<String,Object> configMap=new HashMap<>();

configMap.put("SERVER_PORT",8565);

SpringApplication.setDefaultProperties(configMap);

21).How to change Context path?

spring.context-path=/SpringApplication

22).How to change Banner?

banner.location=classpath:banner.txt

23).What is Thymeleaf?

Thymeleaf is a serverside template,if we need to run html,xml,css,java we can use.

24).csrf

CrossSiteRequestForgery

25).What is inMemoryAuthenticaltion?

It is a Basic Autthentication.

@EnableWebSecurity

public class Security extends WebSecurityConfigurerAdapter{

@Override

protected void configure(HttpSecurity http) throws Exception {

http.csrf().disable().authorizeRequests().

antMatchers("/hello/**").hasRole("user").and().formLogin();
http.csrf().disable().authorizeRequests().

antMatchers("/morning/**").hasRole("admin").and().formLogin();

@Autowired

public void configureGlobal(AuthenticationManagerBuilder builder) throws


Exception{

builder.inMemoryAuthentication().withUser("admin").password("admin").roles("us
er","admin");

builder.inMemoryAuthentication().withUser("user").password("user").roles("user
");

26).How to enable Security?

using @EnableWebSecurity annotation and extends


WebSecurityConfigurerAdapter class

27).How to enable Method level Security?

using @EnableGlobalMethodSecurity(securedEnable=true)

28).What is @EnableBatchProcessing?

To enable Spring Batch application we need to configure this annotation.

In Configuration file we need to add

spring.batch.initializer.enabled=true;

29).What is Flyway database?

It is OpenSource DB

flyway.enable=true;

flyway.locations="schema location"

30).what is liquibasedb?

Liquibasedb is used to store logs in db.


below table will create when we use LiquibaseDB

databasechanelog

databasechaneloglock

31).Flyway vs LiquiBase?

our project is small go for FlyWay

In our project we are using more than one database go for Liquibase

32).what is HikariCP Connection Pool?

It is a connection Pool.Innstead of DBCP,we can use this.

You might also like