アノテーションインターフェース WithSecurityContext
@TargetSE(ANNOTATION_TYPESE)
@RetentionSE(RUNTIMESE)
@InheritedSE
@DocumentedSE
public @interface WithSecurityContext
使用する SecurityContext を決定するためのアノテーション。factory() 属性には、WithUserDetailsSecurityContextFactory のインスタンスを指定する必要があります。
通常、このアノテーションは、WithMockUser および WithUserDetails で行われるようにメタアノテーションとして使用されます。
WithSecurityContextFactory の独自の実装を作成したい場合は、インターフェースを実装することで作成できます。WithSecurityContextFactory 実装では、Autowired およびその他の Spring セマンティクスを使用することもできます。
- 導入:
- 4.0
必須定数のサマリー
必須要素修飾子と型必須要素説明ClassSE<? extends WithSecurityContextFactory<? extends AnnotationSE>>SecurityContextの作成に使用するWithUserDetailsSecurityContextFactory。オプション要素の概要
オプション要素
要素の詳細
factory
ClassSE<? extends WithSecurityContextFactory<? extends AnnotationSE>> factorySecurityContextの作成に使用するWithUserDetailsSecurityContextFactory。Autowiredおよびその他の Spring アノテーションを含めることができます。- 戻り値:
setupBefore
TestExecutionEvent setupBeforeSecurityContextがいつセットアップされるかを決定します。デフォルトは、TestExecutionListener.beforeTestMethod(TestContext)の間に発生するTestExecutionEvent.TEST_METHODの前です。- 戻り値:
- 前に初期化する
TestExecutionEvent - 導入:
- 5.1
- デフォルト:
- TEST_METHOD