CDI 実装として Weld を使用しています。空のbeans.xmlがある場合、Weldコンテナをインスタンス化するオブジェクトグラフをアセンブルしようとする私の統合テストはうまく機能src/test/java/META-INF/beans.xml
します。これがその簡単なテストです。
public class WeldIntegrationTest {
@Test
public void testInjector() {
new Weld().initialize();
// shouldn't throw exception
}
}
を実行するmvn clean install
と、常に次のようになります。Missing beans.xml file in META-INF!
私のルート フォルダーは、WEB-INF フォルダーを含む "src" と "web" ですが、デフォルトの maven 構造を使用して、"web" を "webapp" に名前を変更し、src/main に移動しました。考えられるすべての合理的な場所を試しました:
- src/main/java/META-INF/beans.xml
- src/test/java/META-INF/beans.xml
- web/WEB-INF/beans.xml
- src/main/webapp/WEB-INF/beans.xml
- src/main/webapp/META-INF/beans.xml
- src/main/webapp/META-INF/(empty) and src/main/webapp/WEB-INF/beans.xml
これまでのところ何も機能しません:/