{"id":23655237,"url":"https://github.com/caplin/guice-example","last_synced_at":"2025-09-01T06:32:49.663Z","repository":{"id":11275226,"uuid":"13682212","full_name":"caplin/Guice-Example","owner":"caplin","description":"An example of fresh guice","archived":false,"fork":false,"pushed_at":"2013-10-19T18:20:54.000Z","size":16592,"stargazers_count":8,"open_issues_count":0,"forks_count":3,"subscribers_count":39,"default_branch":"master","last_synced_at":"2024-04-14T09:42:13.244Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Java","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/caplin.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2013-10-18T15:46:31.000Z","updated_at":"2021-01-12T22:03:11.000Z","dependencies_parsed_at":"2022-08-31T09:11:30.224Z","dependency_job_id":null,"html_url":"https://github.com/caplin/Guice-Example","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caplin%2FGuice-Example","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caplin%2FGuice-Example/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caplin%2FGuice-Example/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/caplin%2FGuice-Example/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/caplin","download_url":"https://codeload.github.com/caplin/Guice-Example/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":231670160,"owners_count":18408699,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-28T19:52:02.581Z","updated_at":"2024-12-28T19:52:03.009Z","avatar_url":"https://github.com/caplin.png","language":"Java","funding_links":[],"categories":[],"sub_categories":[],"readme":"A Guice Dependency Injection Tutorial\n=====================================\n\nThis Java application begins as a simple utility that retrieves FX quotes from Yahoo! and prints them to the console. By moving through the tags you can see the application evolve to use dependency injection, first manually and then using the Guice library. By the end of the project the application will become a Rates DataSource Adapter which can provide streaming rates to the Caplin FX Motif web application.\n\nThe application is used to illustrate the ideas discussed in the Powerpoint presentation at the root of the project.\n\n*Please note, from tag 2.0 onwards you'll need to copy a version of the datasource-java jar into the Blade/DataSource/lib directory of the DataSource and add it to your classpath. This tutorial was done with version datasource-java-6.0.4-268745.jar.*\n\nGuice features covered:\n\n* Standard binding\n* The @Named annotation\n* Assisted Inject\n\nPlus some classes from Guava:\n\n* Multimap\n* EventBus\n\nUsage\n=====\n\nStart by checking out tag \"1.0\". This gives you the starting point for the project - when it runs it will retrieve FX quotes for EURUSD once a second and print them to the console. At this point the application does not use the dependency injection pattern at all, each class instantiates its own dependencies.\n\nThen you can move through the tags/branches to see the application develop!\n\n\u003ctable\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e1.0\u003c/td\u003e\n    \u003ctd\u003eStarting point for the application.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e1.1\u003c/td\u003e\n    \u003ctd\u003eReady for the introduction of a dependency injection library. All dependency resolution is now in the main() method and all dependencies are declared in the constructors.\u003c/td\u003e\n  \u003c/tr\u003e  \n  \u003ctr\u003e\n    \u003ctd\u003e1.2\u003c/td\u003e\n    \u003ctd\u003eDependency injection is implemented using Guice.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e1.2a\u003c/td\u003e\n    \u003ctd\u003eFeature branch showing how dependencies can be moved out of the module into their own classes, using the ScheduledExecutorService as an example.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e1.2b\u003c/td\u003e\n    \u003ctd\u003eFeature branch showing how the @Named annotation can be used to inject different instances of classes. We now inject a String called \"CurrencyPair\" into the Application and a String called \"LogFilePath\" to the AuditLogger.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e1.2c\u003c/td\u003e\n    \u003ctd\u003eFeature branch showing how the injector can be instantied with different modules based on a command line argument.\u003c/td\u003e\n  \u003c/tr\u003e \n  \u003ctr\u003e\n    \u003ctd\u003e1.3\u003c/td\u003e\n    \u003ctd\u003eReady for the introduction of a factory. We have a new class QuoteBuilder, but how does it create new instances of the Quote class?\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e1.4\u003c/td\u003e\n    \u003ctd\u003eA hand-coded QuoteFactory has been implemented. This is ready to be replaced by Guice Assisted Inject.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e2.0\u003c/td\u003e\n    \u003ctd\u003eThe QuoteBuilder class is now a factory that works using Assisted Inject. Also, the project is now a Caplin DataSource Adapter which can provide streaming FX rates.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e2.1\u003c/td\u003e\n    \u003ctd\u003eThe FXQuoteProvider is slightly simplified by using the Multimap provided in Guava.\u003c/td\u003e\n  \u003c/tr\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e2.2\u003c/td\u003e\n    \u003ctd\u003eA Guava EventBus is now used for posting incoming Quote events.\u003c/td\u003e\n  \u003c/tr\u003e  \n\u003c/table\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaplin%2Fguice-example","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcaplin%2Fguice-example","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcaplin%2Fguice-example/lists"}