アノテーションインターフェース 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