use of javax.inject.Named in project ListenerMusicPlayer by hefuyicoder.
the class NetworkModule method provideKuGouRetrofit.
@Provides
@Named("kugou")
@PerApplication
Retrofit provideKuGouRetrofit() {
String endpointUrl = Constants.BASE_API_URL_KUGOU;
Gson gson = new GsonBuilder().create();
GsonConverterFactory gsonConverterFactory = GsonConverterFactory.create(gson);
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
OkHttpClient client = new OkHttpClient.Builder().cache(new Cache(FileUtil.getHttpCacheDir(ListenerApp.getContext()), Constants.HTTP_CACHE_SIZE)).connectTimeout(Constants.HTTP_CONNECT_TIMEOUT, TimeUnit.MILLISECONDS).readTimeout(Constants.HTTP_READ_TIMEOUT, TimeUnit.MILLISECONDS).build();
// OkHttpClient newClient = client.newBuilder().addInterceptor(loggingInterceptor).build();
Retrofit retrofit = new Retrofit.Builder().baseUrl(endpointUrl).client(client).addConverterFactory(gsonConverterFactory).addCallAdapterFactory(RxJavaCallAdapterFactory.create()).build();
return retrofit;
}
use of javax.inject.Named in project camel by apache.
the class PropertiesConfigurationTest method propertiesComponent.
@Produces
@ApplicationScoped
@Named("properties")
private static PropertiesComponent propertiesComponent() {
Properties configuration = new Properties();
configuration.put("property", "value");
PropertiesComponent component = new PropertiesComponent();
component.setInitialProperties(configuration);
component.setLocation("classpath:camel1.properties,classpath:camel2.properties");
return component;
}
use of javax.inject.Named in project camel by apache.
the class Jms method sjms.
@Produces
@Named("sjms")
@ApplicationScoped
SjmsComponent sjms() {
SjmsComponent component = new SjmsComponent();
component.setConnectionFactory(new ActiveMQConnectionFactory("vm://broker?broker.persistent=false&broker.useShutdownHook=false&broker.useJmx=false"));
component.setConnectionCount(maxConnections);
return component;
}
use of javax.inject.Named in project camel by apache.
the class Application method properties.
@Produces
@ApplicationScoped
@Named("properties")
// "properties" component bean that Camel uses to lookup properties
PropertiesComponent properties(PropertiesParser parser) {
PropertiesComponent component = new PropertiesComponent();
// Use DeltaSpike as configuration source for Camel CDI
component.setPropertiesParser(parser);
return component;
}
use of javax.inject.Named in project OpenAM by OpenRock.
the class CoreRestGuiceModule method getServerAttributeTitles.
@Provides
@Singleton
@Named("ServerAttributeTitles")
public Properties getServerAttributeTitles() throws IOException {
Properties titleProperties = new Properties();
titleProperties.load(getClass().getClassLoader().getResourceAsStream("amConsole.properties"));
return titleProperties;
}
Aggregations