Annotations Flashcards

1
Q

(4 stereotype annotations:)

  • General/generic annotation to make a Spring bean
A

@Component

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

(4 stereotype annotations:)

  • DAO Classes that you want to make a Spring bean
A

@Repository

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

(4 stereotype annotations:)

  • Service Classes that you want to make Spring Bean
A

@Service

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

(4 stereotype annotations:)

  • Controller Classes that you want to make a Spring
A

@Controller

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

will abstract away the dependency injection that it does for you. So to us, it looks automatic and magical.

A

@Autowired

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

used To run a Spring Boot application

A

@SpringBootApplication

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

(spring MVC)

Preferred stereotype annotation for MVC Controllers. Makes the Class a bean, as well as allowing the class to use the annotations below and get noticed by the DispatcherServlet

A

@Controller

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

(Spring MVC)

  • Specifies the path URI (endpoint) that will be delegated to this controller class or method. We also use it to specify particular HTTP verbs.
    @GetMapping
    @PostMapping
    Etc.
A

@RequestMapping

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

(Spring MVC)

  • sets up Cors filtering for us (so that we can get requests from the front end and send back responses)
A

@CrossOrigin

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

(Spring MVC)

  • Converts the body of our response to JSON for us. Placed at either the class level or method level. No more GSON!
A

@ResponseBody

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

(Spring MVC)

  • allows for getting a path variable out of a URI and used in the parameter of the controller method that took the request.
A

@PathVariable

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

(Spring MVC)

  • Parses the JSON body of the request to an object specified in the parameters of the Controller method that took the requests
A

@RequestBody

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

(Spring MVC)

  • This combines the two annotations of @Controller and @ResponseBody. Convenient!!!
A

@RestController

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

(JPA Annotations)

  • Indicates that the Class is meant to be mapped to a DB table
A

@Entity

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

(JPA Annotations)

  • Doesn’t actually make a class a table (@Entity does that) but it’s useful for setting table options such as the name of the table in the database
A

@Table

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

(JPA Annotations)

  • Defines a variable as a column in the table. Hibernate will turn all of a Class’s field in DB columns by default, BUT using the annotation lets us set things such as column name, or constraints like not null, and unique.
A

@Column

17
Q

(JPA Annotations)

  • Declares a variable as a primary key in a table
A

@Id

18
Q

(JPA Annotations)

  • This gives you control over the options for how Hibernate will auto-generate your primary key.
A

@GeneratedValue

19
Q

(JPA Annotations)

define the relationship between our model classes in Java.

A

@ManyToOne/@OneToMany/@ManyToMany -

20
Q

(JPA Annotations)

  • Specifies a column to establish the relationship on. Just like we do normally, this is usually a Foreign Key pointing to the Primary Key of the table being referred to.
A

@JoinColumn

21
Q

(Spring Data Annotations)

Configures how the database transactions behave. See the Transaction notes below, you’ll often need to use this with updates/deletes

A

@Transactional

22
Q

(Spring Data Annotations)

Creates an Interface that provides common methods for child repositories

A

@NoRepositoryBean

23
Q

(Spring Data Annotations)

Parameters can be passed to queries that are defined with @query

A

@param

24
Q

(Spring Data Annotations)

Marks a field in a Model class as the primary key

A

@Id

25
Q

(Spring Data Annotations)

Marks a field as transient, to be ignored by the data store ending during reads/writes.

A

@transient

26
Q

(Spring Data Annotations)

Auditing annotations that will automatically be filled with the current author

A

@CreatedBy,
@LastModifiedBy

27
Q

(Spring Data Annotations)

Auditing annotations that will automatically be filled with the current date

A

Auditing annotations that will automatically be filled with the current date

28
Q

(Spring AOP/ASPECT J)

———- annotates the Class in which we’ll be addressing a certain CCC such as logging. It also needs to be a Spring Bean to work with SpringAOP, so it will have to be annotated with @Component as well.

A

@Aspect

29
Q

(Spring AOP/ASPECT J)

  • The advice executes before the identified JoinPoint/PointCut
A

@Before

30
Q

(Spring AOP/ASPECT J)

  • The advice executes after the identified JoinPoint/PointCut. It has two subflavors:
A

@After

31
Q

(Spring AOP/ASPECT J)

  • The advice executes after the JoinPoint/PointCut returns successfully
A

@AfterReturning

32
Q

(Spring AOP/ASPECT J)

  • The advice executes after the JoinPoint/PointCut throws an error or exception
A

@AfterThrowing

33
Q

(Spring AOP/ASPECT J)

  • Allows for advice to be injected before, during, and after the JoinPoint/PointCut
    This is the most powerful type of advice, because it can actually stop the execution of your PointCut.
A

@Around