1

Maven プロファイルを使用して JUnit テストを実行しています。

Maven プロファイルは次のようになります。

<profile>
    <id>someProfile</id>
    <properties>
        ...
        <some.param>some_value</some.param>
        ... 
    </properties>
</profile>

Spring コンテキスト ファイル ( testContext.xml ):

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
       ...
       xmlns:p="http://www.springframework.org/schema/p"
       ...
       xsi:schemaLocation="...">
    <bean id="someBean" class="someClass"
          scope="singleton"
          autowire="byName"
          init-method="init"
          p:someBeanParam="${some.param}"/>
</beans>

そしてテストクラスは次のように始まります:

@RunWith(SpringJUnit4ClassRunner.class)
@ContextConfiguration(locations = {"classpath:/testContext.xml"})
@Configurable
...

Maven を実行した後、testContext.xml が変更されていないことがわかりました - p:someBeanParamにはまだ値${some.param}がありました。

ここで何が問題なのか、それを解決する方法を教えてください。

前もって感謝します。

4

1 に答える 1