{"action":"created","issue":{"url":"https://api.github.com/repos/mbierlee/poodinis/issues/5","labels_url":"https://api.github.com/repos/mbierlee/poodinis/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/mbierlee/poodinis/issues/5/comments","events_url":"https://api.github.com/repos/mbierlee/poodinis/issues/5/events","html_url":"https://github.com/mbierlee/poodinis/issues/5","id":130173235,"number":5,"title":"Add something for automatically registering the current type","user":{"login":"dhasenan","id":578393,"avatar_url":"https://avatars.githubusercontent.com/u/578393?v=3","gravatar_id":"","url":"https://api.github.com/users/dhasenan","html_url":"https://github.com/dhasenan","followers_url":"https://api.github.com/users/dhasenan/followers","following_url":"https://api.github.com/users/dhasenan/following{/other_user}","gists_url":"https://api.github.com/users/dhasenan/gists{/gist_id}","starred_url":"https://api.github.com/users/dhasenan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dhasenan/subscriptions","organizations_url":"https://api.github.com/users/dhasenan/orgs","repos_url":"https://api.github.com/users/dhasenan/repos","events_url":"https://api.github.com/users/dhasenan/events{/privacy}","received_events_url":"https://api.github.com/users/dhasenan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/mbierlee/poodinis/labels/enhancement","name":"enhancement","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-01-31T19:39:05Z","updated_at":"2016-01-31T21:04:19Z","closed_at":null,"body":"Low-priority enhancement.\r\n\r\nIt's mildly annoying but slightly safer to require all types the container supports to be registered somehow. At the moment, the API requires you to call `DependencyContainer.getInstance.register!type` for each type.\r\n\r\nIt would be nicer to have an `@AutoRegister` attribute. When the container attempts to build a type (either from a direct call from user code to `resolve` or when processing an `@Autowire` attribute), if the type has not explicitly been registered, if it has an `@AutoRegister` attribute, the type is registered automatically.\r\n\r\nAn alternative possibility is providing a mixin to register the enclosing type. I have employed this in my code. However, this doesn't work quite so well when you are attempting to resolve types inside a module constructor or a type's static constructor -- specifically, if the types are in the current module, the success or failure of the `resolve` calls depends on the order of declaration. This would be a minor thing, but vibe.d recommends putting your application startup code in a shared module constructor."},"comment":{"url":"https://api.github.com/repos/mbierlee/poodinis/issues/comments/177610450","html_url":"https://github.com/mbierlee/poodinis/issues/5#issuecomment-177610450","issue_url":"https://api.github.com/repos/mbierlee/poodinis/issues/5","id":177610450,"user":{"login":"mbierlee","id":1678927,"avatar_url":"https://avatars.githubusercontent.com/u/1678927?v=3","gravatar_id":"","url":"https://api.github.com/users/mbierlee","html_url":"https://github.com/mbierlee","followers_url":"https://api.github.com/users/mbierlee/followers","following_url":"https://api.github.com/users/mbierlee/following{/other_user}","gists_url":"https://api.github.com/users/mbierlee/gists{/gist_id}","starred_url":"https://api.github.com/users/mbierlee/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/mbierlee/subscriptions","organizations_url":"https://api.github.com/users/mbierlee/orgs","repos_url":"https://api.github.com/users/mbierlee/repos","events_url":"https://api.github.com/users/mbierlee/events{/privacy}","received_events_url":"https://api.github.com/users/mbierlee/received_events","type":"User","site_admin":false},"created_at":"2016-01-31T21:04:18Z","updated_at":"2016-01-31T21:04:18Z","body":"Interesting. I would actually prefer an auto component scan like in Spring but a register-on-resolve seems like a workable intermediate solution. I will look at it. The annotation-driven solution is more preferable because letting the container handle registration will get rid of order-dependance."}}