what exactly does the @with annotation do? (Play Framework)

后端 未结 2 1195
梦谈多话
梦谈多话 2020-12-31 21:42

I don\'t quite understand what the @with annotation does.

in the Play framework site, it is written :

we can annotate the controllers using t

2条回答
  •  清歌不尽
    2020-12-31 22:37

    Suppose you have 2 controllers:

    • A has @Before or other controller action injection annotations,
    • B get annotated with @With(A.class)

    All those injection actions defined in A will be effective when calling B's action methods.

    It's kind of inheritance. However with inheritance you can extend at most one class. But you can do @With({A.class, Z.class, ...})

提交回复
热议问题