- Objective - to implement a webservice which exposes endpoints for creating, reading, updating, and deleting
Baker
andMuffin
objects. - Purpose - to demonstrate the use of
- This project is a complete Spring boot application with annotations removed.
- Your objective is to add the correct annotations above each class member which requires it.
- Some tests have been created. However, the the veracity of the application should be tested by making HTTP-requests via the Postman application.
- Annotates class signature
- Description:
- Allows the persistence provider to recognize it as a persistence class.
- An object representative of a snap shot of data from a database.
- By default, maps this entity to a table whose name is the name of the annotated class. Can be rerouted via the
@Table
annotation - Entities are said to be fungible, or mutually interchangeable.
- Pre-requesites for use:
- An interface cannot be an entity.
- An enum cannot be an entity.
- The class can be abstract or concrete.
- The class must define a no-arg constructor.
- Each
Entity
must be annotated with a respectiveID
.
- Annotates field declarations
- Description:
- Denotes the primary key for this
Entity
. - Can be generated manually by application or by automatically by the persistence provider.
- Denotes the primary key for this
- Pre-requisites for use:
- Class must be annotated with
@Entity
- Class must be annotated with
- Annotates
Id
fields. - Description:
- Specifies how the persistence provider will generate this value.
GenerationType.SEQUENCE
- specifies the use of database SQL sequenceGenerationType.IDENTITY
- uses a database identity columnGenerationType.TABLE
- instructs provider to store the sequence name and its current value in a table, increasing the value of each time a new instance of the entity is persisted.GenerationType.AUTO
- default when nothing specified. Provider does generation of a key automatically. It will select an appropriate strategy for a particular database.
- Pre-requesites for use:
- Field must be annotated with
@Id
.
- Field must be annotated with
- Annotates field declaration or method-parameters
- Description
- injects bean by type
- can be used alone.
- If is used alone, it will be wired by type
- If more than one bean of same type are declared in the container
@Autowired
does not know which beans to use for injection.
- Pre-requesites for use:
- Field-type must be annotated with some form of
@Component
.
- Field-type must be annotated with some form of
- Annotates class signature
- Description
- denotes that Spring framework will autodetect these classes for dependency injection when annotation-based configuration and classpath scanning is used.
- Prerequisites for use:
- none
- Annotates class signature
- Description
- specialized form of
@Component
- responsible for performing service tasks
- in many case you use this annotation for best practice, but isn't always necessary.
- specialized form of
- Prerequisites for use:
- none
- Annotates class signature
- Description
- specialized form of
@Component
- indicates that a particular class serves the role of a controller
- acts as a stereotype for the annotated class, indicating its role
- dispatcher scans such annotated classes for mapped methods and detects @RequestMapping annotations
- specialized form of
- Pre-requesites for use:
- none
- Annotates a method signature
- Description
- annotation maps HTTP requests to handler methods of MVC and REST controllers.
- Pre-requesites for use
- class must be a annotated with
@Controller
- class must be a annotated with
- Annotates a method parameter
- Description
- indicates that a method parameter should be bound to a URI template variable
- Pre-requesites for use
- class must be a annotated with
@Controller
- class must be a annotated with
- Annotates a method parameter
- Description
- indicates that a method parameter should be bound to a web request parameter
- used to extract query parameters, form parameters
- Pre-requesites for use
- class must be a annotated with
@Controller
- class must be a annotated with