我添加了带有tomcat上下文的web.xml配置文件,如下所示。似乎以此配置开始的tomcat实例无法识别bean.xml文件,因为我不能使用@Inject注释。问题是,我如何使tomcat识别beans.xml文件。谢谢。
Tomcat tomcat = new Tomcat();
tomcat.setPort(Integer.valueOf(webPort));
Context context = tomcat.addWebapp("/", new File(webappDirLocation).getAbsolutePath());
File configFile = new File(webappDirLocation + "WEB- INF/web.xml");
context.setConfigFile(configFile.toURI().toURL());
tomcat.start();
tomcat.getServer().await();