クラス TestConstructorUtils
java.lang.ObjectSE
org.springframework.test.context.support.TestConstructorUtils
@TestConstructor を操作するためのユーティリティメソッド。主にフレームワーク内での使用を目的としています。
- 導入:
- 5.2
- 作成者:
- Sam Brannen, Florian Lehmann
- 関連事項:
メソッドのサマリー
修飾子と型メソッド説明static booleanisAutowirableConstructor(ConstructorSE<?> constructor, ClassSE<?> testClass) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。static booleanisAutowirableConstructor(ConstructorSE<?> constructor, ClassSE<?> testClass, @Nullable PropertyProvider fallbackPropertyProvider) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。6.2.13 時点ではisAutowirableConstructor(Executable, PropertyProvider)が優先されますが、Spring Framework 7.1 で削除されます。static booleanisAutowirableConstructor(ExecutableSE executable, ClassSE<?> testClass) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。6.2.13 時点ではisAutowirableConstructor(Executable, PropertyProvider)が優先されますが、Spring Framework 7.1 で削除されます。static booleanisAutowirableConstructor(ExecutableSE executable, ClassSE<?> testClass, @Nullable PropertyProvider fallbackPropertyProvider) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。6.2.13 時点ではisAutowirableConstructor(Executable, PropertyProvider)が優先されますが、Spring Framework 7.1 で削除されます。static booleanisAutowirableConstructor(ExecutableSE executable, @Nullable PropertyProvider fallbackPropertyProvider) 提供されたExecutableSE がオートワイヤー可能なConstructorSE であるかどうかを判断します。
メソッドの詳細
isAutowirableConstructor
@DeprecatedSE(since="6.2.13", forRemoval=true) public static boolean isAutowirableConstructor(ExecutableSE executable, ClassSE<?> testClass) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。6.2.13 時点ではisAutowirableConstructor(Executable, PropertyProvider)が優先されますが、Spring Framework 7.1 で削除されます。指定されたテストクラスの提供された実行可能ファイルが自動作成可能なコンストラクターであるかどうかを判断します。このメソッドは
isAutowirableConstructor(Executable, Class, PropertyProvider)に委譲し、フォールバックPropertyProviderのnullの値になります。- パラメーター:
executable- テストクラスの実行可能ファイルtestClass- テストクラス- 戻り値:
true(実行可能ファイルが自動起動可能なコンストラクターの場合)- 関連事項:
isAutowirableConstructor
@DeprecatedSE(since="6.2.13", forRemoval=true) public static boolean isAutowirableConstructor(ConstructorSE<?> constructor, ClassSE<?> testClass) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。6.2.13 時点ではisAutowirableConstructor(Executable, PropertyProvider)が優先されますが、Spring Framework 7.1 で削除されます。指定されたテストクラスに指定されたコンストラクターが自動書き込み可能かどうかを判断します。このメソッドは
isAutowirableConstructor(Constructor, Class, PropertyProvider)に委譲し、フォールバックPropertyProviderのnullの値になります。- パラメーター:
constructor- テストクラスのコンストラクターtestClass- テストクラス- 戻り値:
true(コンストラクターがオートワイヤー可能の場合)- 関連事項:
isAutowirableConstructor
@DeprecatedSE(since="6.2.13", forRemoval=true) public static boolean isAutowirableConstructor(ExecutableSE executable, ClassSE<?> testClass, @Nullable PropertyProvider fallbackPropertyProvider) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。6.2.13 時点ではisAutowirableConstructor(Executable, PropertyProvider)が優先されますが、Spring Framework 7.1 で削除されます。指定されたテストクラスの提供された実行可能ファイルが自動作成可能なコンストラクターであるかどうかを判断します。このメソッドは、提供された実行可能ファイルがコンストラクターである場合は
isAutowirableConstructor(Constructor, Class, PropertyProvider)に委譲し、そうでない場合はfalseを返します。- パラメーター:
executable- テストクラスの実行可能ファイルtestClass- テストクラスfallbackPropertyProvider-SpringPropertiesにそのような値が見つからない場合、TestConstructor.TEST_CONSTRUCTOR_AUTOWIRE_MODE_PROPERTY_NAMEの値を検索するために使用されるフォールバックプロパティプロバイダー- 戻り値:
true(実行可能ファイルが自動起動可能なコンストラクターの場合)- 導入:
- 5.3
- 関連事項:
isAutowirableConstructor
@DeprecatedSE(since="6.2.13", forRemoval=true) public static boolean isAutowirableConstructor(ConstructorSE<?> constructor, ClassSE<?> testClass, @Nullable PropertyProvider fallbackPropertyProvider) 非推奨、削除予定: この API 要素は、将来のバージョンで削除される可能性があります。6.2.13 時点ではisAutowirableConstructor(Executable, PropertyProvider)が優先されますが、Spring Framework 7.1 で削除されます。指定されたテストクラスに指定されたコンストラクターが自動書き込み可能かどうかを判断します。次のいずれかの条件が
trueの場合、コンストラクターは自動書き込み可能と見なされます。- コンストラクターには、
@Autowiredまたは@jakarta.inject.Injectのアノテーションが付けられます。 autowireModeがALLに設定されているテストクラスに、@TestConstructorが存在またはメタ存在します。- デフォルトのテストコンストラクターのオートワイヤーモードは、
SpringPropertiesまたは付属のフォールバックPropertyProviderでALLに設定されています(TestConstructor.TEST_CONSTRUCTOR_AUTOWIRE_MODE_PROPERTY_NAMEを参照)。
- パラメーター:
constructor- テストクラスのコンストラクターtestClass- テストクラス(通常はコンストラクターの宣言クラス)fallbackPropertyProvider-SpringPropertiesにそのような値が見つからない場合に、TestConstructor.TEST_CONSTRUCTOR_AUTOWIRE_MODE_PROPERTY_NAMEの値を検索するために使用されるフォールバックプロパティプロバイダー。フォールバックサポートがない場合は、nullになる場合があります。- 戻り値:
true(コンストラクターがオートワイヤー可能の場合)- 導入:
- 5.3
- 関連事項:
- コンストラクターには、
isAutowirableConstructor
public static boolean isAutowirableConstructor(ExecutableSE executable, @Nullable PropertyProvider fallbackPropertyProvider) 提供されたExecutableSE がオートワイヤー可能なConstructorSE であるかどうかを判断します。次のいずれかの条件が
trueの場合、コンストラクターは自動書き込み可能と見なされます。- コンストラクターには、
@Autowiredまたは@jakarta.inject.Injectのアノテーションが付けられます。 autowireModeがALLに設定されているテストクラスに、@TestConstructorが存在またはメタ存在します。- デフォルトのテストコンストラクターのオートワイヤーモードは、
SpringPropertiesまたは指定されたフォールバックPropertyProviderのALLに設定されています。
- パラメーター:
executable- テストクラス用のExecutablefallbackPropertyProvider-SpringPropertiesにそのような値が見つからない場合に、"spring.test.constructor.autowire.mode" の値を検索するために使用されるフォールバックプロパティプロバイダー。フォールバックサポートがない場合は、nullになる場合があります。- 戻り値:
true(実行可能ファイルが自動起動可能なコンストラクターの場合)- 導入:
- 6.2.13
- 関連事項:
- コンストラクターには、
isAutowirableConstructor(Executable, PropertyProvider)が優先されますが、Spring Framework 7.1 で削除されます。