Specifies how the persistence provider will generate this value.
GenerationType.SEQUENCE - specifies the use of database SQL sequence
GenerationType.IDENTITY - uses a database identity column
GenerationType.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.
@Autowired
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.
@Component
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
@Service
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.
Prerequisites for use:
none
@Controller
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
Pre-requesites for use:
none
@RequestMapping
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
@PathVariable
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
@RequestParam
Annotates a method parameter
Description
indicates that a method parameter should be bound to a web request parameter
请发表评论