{"id":912,"date":"2011-03-25T14:44:37","date_gmt":"2011-03-25T12:44:37","guid":{"rendered":"http:\/\/www.tutego.de\/blog\/javainsel\/2011\/03\/guice-3-0-ist-raus\/"},"modified":"2011-03-25T14:44:37","modified_gmt":"2011-03-25T12:44:37","slug":"guice-3-0-ist-raus","status":"publish","type":"post","link":"https:\/\/www.tutego.de\/blog\/javainsel\/2011\/03\/guice-3-0-ist-raus\/","title":{"rendered":"Guice 3.0 ist raus"},"content":{"rendered":"<p>Nach laaaanger Wartezeit ist DI-Framework Guice 3.0 ver\u00f6ffentlicht worden. Von <a href=\"http:\/\/code.google.com\/p\/google-guice\/wiki\/Guice30\">http:\/\/code.google.com\/p\/google-guice\/wiki\/Guice30<\/a> die Neuerungen:<\/p>\n<blockquote>\n<ul>\n<li><a href=\"http:\/\/code.google.com\/p\/google-guice\/wiki\/JSR330\">JSR 330 support<\/a><\/li>\n<li><a href=\"http:\/\/code.google.com\/p\/google-guice\/wiki\/GuicePersist\">New Persist extension<\/a><\/li>\n<li><a href=\"http:\/\/code.google.com\/p\/google-guice\/wiki\/ToConstructorBindings\">ToConstructor Bindings<\/a><\/li>\n<li>Better OSGi support (and generally improved support for multiple classloaders) <\/li>\n<li>New methods in Binder: <tt>requireExplicitBindings<\/tt> &amp; <tt>disableCircularProxies<\/tt><\/li>\n<li>Much simpler stack traces when AOP is involved <\/li>\n<li>Exact duplicate bindings are ignored (instead of an exception being thrown) <\/li>\n<li>Repackaged cglib, asm &amp; guava classes are now hidden from IDE auto-imports <\/li>\n<li>Source can be built with Maven <\/li>\n<li>General extension &amp; SPI improvements:\n<ul>\n<li><a href=\"http:\/\/code.google.com\/p\/google-guice\/wiki\/ExtensionSPI\">Extensions SPI<\/a>, with support from the <a href=\"http:\/\/code.google.com\/p\/google-guice\/wiki\/Multibindings\">Multibindings<\/a>, <a href=\"http:\/\/code.google.com\/p\/google-guice\/wiki\/ServletModule\">ServletModule<\/a> and <a href=\"http:\/\/code.google.com\/p\/google-guice\/wiki\/AssistedInject\">AssistedInject<\/a> extensions. <\/li>\n<li><tt>@Toolable<\/tt>, for use by extensions in Stage.TOOL <\/li>\n<li>All binding implementations implement <tt>HasDependencies<\/tt><\/li>\n<\/ul>\n<\/li>\n<li>Scope improvements:\n<ul>\n<li><tt>Scopes.isSingleton<\/tt><\/li>\n<li>toInstance bindings are considered eager singletons in the Scope SPI <\/li>\n<li>Singleton providers that return null are now scoped properly. <\/li>\n<li>Fail when circularly dependent singletons cannot be proxied (previously two instances may have been created)<\/li>\n<\/ul>\n<\/li>\n<li>Provider Method (@Provides) improvements:\n<ul>\n<li>Logger dependencies now use named instead of anonymous loggers <\/li>\n<li>Exceptions produce a simpler stack<\/li>\n<\/ul>\n<\/li>\n<li>Private Modules improvements:\n<ul>\n<li>If a single <tt>PrivateModule<\/tt> is passed to Modules.override, private elements can be overridden. <\/li>\n<li>If many modules are passed to Modules.override, exposed keys can be overridden.<\/li>\n<\/ul>\n<\/li>\n<li><tt>Multibinder<\/tt> &amp; <tt>MapBinder<\/tt> extension improvements:\n<ul>\n<li><tt>permitDuplicates<\/tt> &#8212; allows <tt>MapBinder<\/tt> to inject a <tt>Map&lt;K, Set&lt;V&gt;&gt;<\/tt> and a <tt>Map&lt;K, Set&lt;Provider&lt;V&gt;&gt;<\/tt> and <tt>Multibinder<\/tt> to silently ignore duplicate entries <\/li>\n<li>Expose dependencies in Stage.TOOL, and return a dependency on Injector (instead of null) when working with Elements. <\/li>\n<li>Co-exist nicely with Modules.override <\/li>\n<li>Work properly with marker (parameterless) annotations <\/li>\n<li>Expose details through the new extensions SPI<\/li>\n<\/ul>\n<\/li>\n<li>Servlet extension improvements:\n<ul>\n<li>Added <tt>with(instance)<\/tt> for servlet bindings. <\/li>\n<li>Support multiple injectors using <a href=\"http:\/\/code.google.com\/p\/google-guice\/wiki\/ServletModule\">ServletModule<\/a> in the same JVM. <\/li>\n<li>Support thread-continuations (allow background threads to process an <tt>HttpRequest<\/tt>) <\/li>\n<li>Support manually seeding a <tt>@RequestScope<\/tt><\/li>\n<li>Expose details through new extensions SPI <\/li>\n<li>Fix request forwarding <\/li>\n<li>Performance improvements for the filter &amp; servlet pipelines <\/li>\n<li>Expose the servlet context (<tt>ServletModule.getServletContext<\/tt>) <\/li>\n<li>Fixed so a single <a href=\"http:\/\/code.google.com\/p\/google-guice\/wiki\/ServletModule\">ServletModule<\/a> instance can be used twice (in, say Element.getElements &amp; creating an Injector) <\/li>\n<li>Fix to work with context paths<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"http:\/\/code.google.com\/p\/google-guice\/wiki\/AssistedInject\">AssistedInject<\/a> extension improvements\n<ul>\n<li>New <tt>FactoryModuleBuilder<\/tt> for building assisted factories <\/li>\n<li>Injection is done through child injectors and can participate in AOP <\/li>\n<li>Performance improvements <\/li>\n<li>Multiple different implementations can be created from a single factory <\/li>\n<li>Incorrect implementations or factories are detected in Stage.TOOL, and more error-checking with better error messages <\/li>\n<li>Work better with parameterized types <\/li>\n<li>Expose details through new extensions SPI<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"http:\/\/code.google.com\/p\/google-guice\/wiki\/ThrowingProviders\">ThrowingProviders<\/a> extension improvements\n<ul>\n<li>Added a new CheckedProviders interface that allows more than one exception to be thrown. <\/li>\n<li>Added @CheckedProvides allowing @Provides-like syntax for CheckedProviders. <\/li>\n<li>Dependencies are checked at Injector-creation time and during Stage.TOOL, so they can fail early <\/li>\n<li>Bindings created by ThrowingProviderBinder now return proper dependencies instead of Injector.<\/li>\n<\/ul>\n<\/li>\n<li><a href=\"http:\/\/code.google.com\/p\/google-guice\/wiki\/Struts2Integration\">Struts2<\/a>\n<ul>\n<li>The Struts2 extension now works again! (It worked in Guice 1.0 and was somewhat broken in Guice 2.0)<\/li>\n<\/ul>\n<\/li>\n<li>Added to Injector: <tt>getAllBindings<\/tt>, <tt>getExistingBinding<\/tt>, <tt>getScopeBindings<\/tt>, <tt>getTypeConverterBindings<\/tt>. <\/li>\n<li>Added to Key: <tt>hasAttributes<\/tt>, <tt>ofType<\/tt>, <tt>withoutAttributes<\/tt><\/li>\n<li>Various bug fixes \/ improvements:\n<ul>\n<li>Prevent child injectors from rebinding a parent just-in-time binding. <\/li>\n<li>Non-intercepted methods in a class with other intercepted methods no longer go through cglib (reducing total stack frames). <\/li>\n<li>Allow Guice to work on generated classes. <\/li>\n<li>Fix calling Provider.get() of an unrelated Provider in a scoping method. <\/li>\n<li><tt>MoreTypes.getRawTypes<\/tt> returns the proper types for arrays (instead of Object.class) <\/li>\n<li>JIT bindings left in a parent injector when child injectors fail creating a JIT binding are now removed <\/li>\n<li>Overriding an @Inject method (if the subclass also annotates the method with @Inject) no longer injects the method twice <\/li>\n<li>You can now bind byte constants (using <tt>ConstantBindingBuilder.to(byte)<\/tt>) <\/li>\n<li>Better exceptions when trying to intercept final classes, using keys already bound in child or private module, and many other cases. <\/li>\n<li>ConvertedConstantBinding now exposes the TypeConverterBinding used to convert the constant.<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<\/blockquote>\n","protected":false},"excerpt":{"rendered":"<p>Nach laaaanger Wartezeit ist DI-Framework Guice 3.0 ver\u00f6ffentlicht worden. Von http:\/\/code.google.com\/p\/google-guice\/wiki\/Guice30 die Neuerungen: JSR 330 support New Persist extension ToConstructor Bindings Better OSGi support (and generally improved support for multiple classloaders) New methods in Binder: requireExplicitBindings &amp; disableCircularProxies Much simpler stack traces when AOP is involved Exact duplicate bindings are ignored (instead of an exception [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":"","_links_to":"","_links_to_target":""},"categories":[4],"tags":[47,53],"class_list":["post-912","post","type-post","status-publish","format-standard","hentry","category-open-source","tag-google","tag-guice"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/posts\/912","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/comments?post=912"}],"version-history":[{"count":0,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/posts\/912\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/media?parent=912"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/categories?post=912"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.tutego.de\/blog\/javainsel\/wp-json\/wp\/v2\/tags?post=912"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}