Skip to main content
deleted 9 characters in body
Source Link
Gelin Luo
  • 14.4k
  • 30
  • 91
  • 144

Suppose you have 2 controllers:

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

A has @Before or other controller action injection annotations, and you annotate B with @With(A.class), then allAll those injection actionactions defined in AA will be effective when calling B'sB's action methods. 

It's same as inheritance but avoid the limitationkind of inheritance, say. However with inheritance you can extendsextend at most one another class. But you can do @With({A.class, Z.class, ...})@With({A.class, Z.class, ...})

Suppose you have 2 controllers:

A has @Before or other controller action injection annotations, and you annotate B with @With(A.class), then all those injection action defined in A will be effective when calling B's action methods. It's same as inheritance but avoid the limitation of inheritance, say you can extends at most one another class. But you can do @With({A.class, Z.class, ...})

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, ...})

Source Link
Gelin Luo
  • 14.4k
  • 30
  • 91
  • 144

Suppose you have 2 controllers:

A has @Before or other controller action injection annotations, and you annotate B with @With(A.class), then all those injection action defined in A will be effective when calling B's action methods. It's same as inheritance but avoid the limitation of inheritance, say you can extends at most one another class. But you can do @With({A.class, Z.class, ...})