• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

lthomas4912/Maven.Spring-BakeryAnnotations

原作者: [db:作者] 来自: 网络 收藏 邀请

开源软件名称(OpenSource Name):

lthomas4912/Maven.Spring-BakeryAnnotations

开源软件地址(OpenSource Url):

https://github.com/lthomas4912/Maven.Spring-BakeryAnnotations

开源编程语言(OpenSource Language):

Java 100.0%

开源软件介绍(OpenSource Introduction):

Wilhem's Wacky Bakery

Instructions

  • 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.

Developmental Notes

@Entity

  • 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 respective ID.

@Id

  • Annotates field declarations
  • Description:
    • Denotes the primary key for this Entity.
    • Can be generated manually by application or by automatically by the persistence provider.
  • Pre-requisites for use:
    • Class must be annotated with @Entity

@GeneratedValue(strategy = GenerationType.ENUM_VALUE)

  • Annotates Id fields.
  • Description:
    • 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
    • used to extract query parameters, form parameters
  • Pre-requesites for use
    • class must be a annotated with @Controller



鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
redfish4ktc/maven-soapui-extension-plugin: This plugin adds new features and bug ...发布时间:2022-08-17
下一篇:
Ansible Galaxy发布时间:2022-08-17
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap