Skip to content

Commit

Permalink
Fix guice dependency resolution
Browse files Browse the repository at this point in the history
  • Loading branch information
HoussemNasri committed Oct 25, 2024
1 parent 0a093a6 commit eef7eef
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
openpaas.api.uri=http://localhost:5032
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import com.google.inject.AbstractModule;
import com.google.inject.Provides;
import com.google.inject.multibindings.ProvidesIntoSet;
import com.linagora.tmail.api.OpenPaasRestClient;
import com.linagora.tmail.contact.OpenPaasContactsConsumer;

public class OpenPaasModule extends AbstractModule {
Expand All @@ -40,7 +41,7 @@ public InitializationOperation initializeContactsConsumer(OpenPaasContactsConsum
@Provides
@Named(OPENPAAS_CONFIGURATION_NAME)
@Singleton
private Configuration providePropertiesConfiguration(PropertiesProvider propertiesProvider) throws ConfigurationException {
public Configuration providePropertiesConfiguration(PropertiesProvider propertiesProvider) throws ConfigurationException {
try {
return propertiesProvider.getConfiguration(OPENPAAS_CONFIGURATION_NAME);
} catch (FileNotFoundException e) {
Expand All @@ -52,10 +53,15 @@ private Configuration providePropertiesConfiguration(PropertiesProvider properti

@Provides
@Singleton
protected OpenPaasConfiguration provideOpenPaasConfiguration(@Named(OPENPAAS_CONFIGURATION_NAME) Configuration propertiesConfiguration) {
public OpenPaasConfiguration provideOpenPaasConfiguration(@Named(OPENPAAS_CONFIGURATION_NAME) Configuration propertiesConfiguration) {
return OpenPaasConfiguration.from(propertiesConfiguration);
}

@Provides
public OpenPaasRestClient provideOpenPaasRestCLient(OpenPaasConfiguration openPaasConfiguration) {
return new OpenPaasRestClient(openPaasConfiguration);
}

@Provides
@Named(OPENPAAS_INJECTION_KEY)
@Singleton
Expand All @@ -69,7 +75,7 @@ public RabbitMQConfiguration provideRabbitMQConfiguration(OpenPaasConfiguration
@Named(OPENPAAS_INJECTION_KEY)
@Singleton
public SimpleConnectionPool provideSimpleConnectionPool(@Named(OPENPAAS_INJECTION_KEY) RabbitMQConfiguration rabbitMQConfiguration,
Provider<Configuration> configuration) {
@Named(OPENPAAS_CONFIGURATION_NAME) Provider<Configuration> configuration) {
RabbitMQConnectionFactory rabbitMQConnectionFactory = new RabbitMQConnectionFactory(rabbitMQConfiguration);
try {
return new SimpleConnectionPool(rabbitMQConnectionFactory, SimpleConnectionPool.Configuration.from(configuration.get()));
Expand All @@ -82,7 +88,7 @@ public SimpleConnectionPool provideSimpleConnectionPool(@Named(OPENPAAS_INJECTIO
@Provides
@Named(OPENPAAS_INJECTION_KEY)
@Singleton
ReactorRabbitMQChannelPool provideReactorRabbitMQChannelPool(
public ReactorRabbitMQChannelPool provideReactorRabbitMQChannelPool(
OpenPaasConfiguration openPaasConfiguration,
@Named(OPENPAAS_INJECTION_KEY) SimpleConnectionPool simpleConnectionPool,
ReactorRabbitMQChannelPool.Configuration configuration,
Expand Down

0 comments on commit eef7eef

Please sign in to comment.