SpringBoot
SpringBoot
Cloud Support
Spring-boot-starter-parent
Apache Derby
H2 DB
HSQLDB
5).What is CommandLineRunner
6).what is @SpringBootApplication?
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.
CrudRepository
PagingAndSortingRepository
JpaRepository
@Query
@NamedQuery
-->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
https://localhost:8090/health
We we need to access sensitive info we need to add below property in application.properties file
management.security.enabled=false
management.port=9999
15).what is spring-boot-starter-security
management.security.enabled=true
security.basic.enabled=true
security.user.name=admin
security.user.password=root
If we modified any changes in code,If we want to restart automatically we need to add spring-
boot-devtool.jar in pom.xml
logging.level.root=debug;
logging.path=logs
18).what is Profiles?
eg:-
application.properties
application-dev.properties
application-prod.properties
eg:
@service
@Profile("dev")
@Override
}
spring.profiles.active=prod
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.
configMap.put("SERVER_PORT",8565);
SpringApplication.setDefaultProperties(configMap);
spring.context-path=/SpringApplication
banner.location=classpath:banner.txt
23).What is Thymeleaf?
24).csrf
CrossSiteRequestForgery
25).What is inMemoryAuthenticaltion?
It is a Basic Autthentication.
@EnableWebSecurity
@Override
http.csrf().disable().authorizeRequests().
antMatchers("/hello/**").hasRole("user").and().formLogin();
http.csrf().disable().authorizeRequests().
antMatchers("/morning/**").hasRole("admin").and().formLogin();
@Autowired
builder.inMemoryAuthentication().withUser("admin").password("admin").roles("us
er","admin");
builder.inMemoryAuthentication().withUser("user").password("user").roles("user
");
using @EnableGlobalMethodSecurity(securedEnable=true)
28).What is @EnableBatchProcessing?
spring.batch.initializer.enabled=true;
It is OpenSource DB
flyway.enable=true;
flyway.locations="schema location"
30).what is liquibasedb?
databasechanelog
databasechaneloglock
31).Flyway vs LiquiBase?
In our project we are using more than one database go for Liquibase