0

インジェクション用に異なる Bean を提供する TestSuite の構成が 2 つあります。これは、プロファイルに注釈を設定している限り機能します。

@ActiveProfiles( profiles={"a"})@ActiveProfiles( profiles={"b"})

しかし、プロパティソースファイルから設定できないようです

私の注釈は次のようになります

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(classes = {AConfig.class, BConfig.class })
@PropertySource("classpath:/application.properties")
@TestPropertySource(locations = {"classpath:/application.properties"})
public abstract class AbstractTestIT {
   ...
}

そして内容はapplication.properties

spring.profiles.active="a"

そして、満たされていない依存関係が生じます

前述のように@ActiveProfiles、上記の設定が機能し、正しいものが使用されます。

PropertySource および/または TestPropertySource が機能しないかのようです@RunWith(SpringJUnit4ClassRunner.class)

4

1 に答える 1