我试图在 Java 应用程序中嵌入 Apache James 的内存实例,但遇到错误。
我在这里遵循这个例子:
我收到的错误是:
Failed to start application (with profile [dev]): org.apache.commons.configuration2.ex.ConfigurationException: You need to configure a Processor with name error
这是我的代码:
private static final Module PROTOCOLS = Modules.combine(
new IMAPServerModule(),
new ProtocolHandlerModule(),
new MailRepositoryTaskSerializationModule(),
new SMTPServerModule());
private static final Module CUSTOM_SERVER_MODULE = Modules.combine(
new MailetProcessingModule(),
new MailboxModule(),
new MemoryDataModule(),
new MemoryEventStoreModule(),
new MemoryUsersRepositoryModule(),
new MemoryMailboxModule(),
new MemoryQuotaModule(),
new MemoryMailQueueModule(),
new TaskManagerModule(),
new RawPostDequeueDecoratorModule(),
binder -> binder.bind(MailetContainerModule.DefaultProcessorsConfigurationSupplier.class)
.toInstance(BaseHierarchicalConfiguration::new));
private static final Module CUSTOM_SERVER_AGGREGATE_MODULE = Modules.combine(
CUSTOM_SERVER_MODULE,
PROTOCOLS);
private final GuiceJamesServer inMemMailServer;
public MailServerImpl() {
Configuration config = Configuration.builder()
.workingDirectory(myConfigDir)
.configurationPath(new Configuration.ConfigurationPath(myConfigDir))
.build();
this.inMemMailServer = GuiceJamesServer
.forConfiguration(config)
.combineWith(CUSTOM_SERVER_AGGREGATE_MODULE);
}