Spring Boot-301 Flashcards

1
Q

What is spring.provides

A

Each starter has a spring .provides file, which tells by using this starter package what we will get it : spring-test, spring-boot, spring-junit…

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

What is the nomenclature for starter pack?

A

spring-boot-starter-[…](web, data,

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is a CommandLineRunner

A

scan all components and invokes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

How can we the Order of invokation of beans?

A

@Order or implement and Ordered IF

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Is there a IN to extends in corresponding to each @Spring Annotation

A

Yes , extend it and customize

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

Does Boot creates the DataSource automatically?

A

Yes the Boot will create DS for H2, Derby , HSQL, just have to add one in CP

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Show the class of SpringBootApplication ?

A
@Configuration
@EnableAutoConfiguration
@ComponentScan
public Interface SpringBootApplication {
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Is SpringBootApplication an IF

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

What @Configuration does?

A

It says that @BEan, @ComponentScan & @Service

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What @ComponentScan does?

A

It says that to scan all base packages for Spring annotaions. THe base package is the package the SpringBootApplication belongs to

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

What @EnableAutoConfiguratioon?

A

It composes of EnableAutoConfigurationalImmortSelecrtor

& ConfigurationPackages.Registrar to automatically configure the conditional beans

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What does SpringApplication.run does?

A

It creates a Spring application context, that reads the annotations of class in parenthesis and instantiates

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

IS CommandLineInterface is and IF?

A

Yes

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Which method CommandLineInterface has>?

A

Just one method public void run(String… args)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

What is the relevance of run in CommandLineInterface

A

it just called once when SpringBoots

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Which class is we have for DataOperations?

A

DataSource

17
Q

Are there DB predefined properties for DS?

A

Yes in app.prop spring.datasource.url, spring.datasource.username, spring.datasource.password
and the like

18
Q

IS it possible to configure DS external to Boot App, like JBoss, tomcat and the like ?

A

YEs by using spring.datasource.jndi-name

19
Q

Can we use - in app.props ?

A

Yes and they get transalated to camel case

20
Q

Can we configure the hibernate props also in app.props?

A

Yes, like spring.jpa.hibernate.ddl-auto=create-drop

21
Q

Is DS can be wrapped onve JDBCTemplate?

A

Yes,
Use
@Autowired
private JdbcTemplate jdbcTemplate;

22
Q

Which class is for DS?

A

org. springframework.boot.autoconfig-

ure. jdbc.DataSourceAutoConfiguration

23
Q

How can we create a repository?

A

By extending CrudRepository

24
Q

Name some annotations of Java persistence api?

A

@Entity, @Id, @GeneratedValue, @OneToMany, @ManyToOne, @ManyToMany

25
Q

Why it is important to have a protected constructor in an @Entityclass?

A

it is needed for automatic instantiation and hibernate interactions

26
Q

what is the relevance of @Entity?

A

It is meant to map the entity class to table object

27
Q

what is the relevance of @Repository?

A

This IF is intended to provide them with the access and manipulation of data for a database

28
Q

what is the relevance of CrudRepository?

A

It gives the basic CRUD operations on a table object