1
我有兩個必須組合的Java應用程序。一個是Spring,其中的方法需要被第二個調用,一個Elasticsearch插件(我不認爲它可以變成一個Spring應用程序,因爲它已經使用某種形式的Guice進行依賴注入)。根據來自非Spring項目的Spring項目
春季類我需要調用看起來像:
@Component
public class DataServiceController {
//This is defined within a @Config
@Autowired
DataTypesMap dataTypesMap;
/**
* Create an item in the data platform
*/
public ItemCreatedResponse createItem(String data, String dataType)
throws IOException {
ProcessStrategy dataStrategy = dataTypesMap.get(dataType);
return dataStrategy.add(data);
}
如果我只是添加這個項目作爲ES插件內的Maven的依賴,將自動裝配Autowired dataTypesMap
總是空(這是可以預料的是什麼在Elasticsearch插件將告訴它如何自動裝配)。
我能在這裏做什麼?