Guice 7.0.0
Guice 7.0.0
Released May 12th, 2023.
Maven
Guice:
<dependency>
<groupId>com.google.inject</groupId>
<artifactId>guice</artifactId>
<version>7.0.0</version>
</dependency>Extensions:
<dependency>
<groupId>com.google.inject.extensions</groupId>
<artifactId>guice-${extension}</artifactId>
<version>7.0.0</version>
</dependency>Downloads
- Guice: guice-7.0.0.jar
- Guice extensions are all directly downloadable from this search page. Just click on the "jar" link for the appropriate extension.
Docs
Changes since Guice 5.1.0
JEE Jakarta Transition
Guice 7.0 ONLY supports the jakarta.inject, jakarta.servlet and jakarta.persistence namespaces. It DOES NOT support javax.inject, javax.servlet, nor javax.persistence. The following links talk more about the jakarta transition: Jarkata EE blog post, Eclipse Foundation blog post, Jakarta EE Wikipedia article, Oracle blog post
Guice 6.0 is being released alongside Guice 7.0 and is intended to help users migrate their code to the jakarta namespace. Guice 6.0 continues to fully support the javax.inject namespace while also mostly supporting the jakarta.inject namespace. The only part of Guice 6.0 that doesn't support jakarta.inject are the bind(..).toProvider methods.
The Guice 6.0 servlet & persist extensions only support the javax.servlet and javax.persistence namespaces respectively. If compatibility with jakarta.servlet or jakarta.persistence is required, use Guice 7.0.
Guice 7.0 removes support for javax.inject, javax.servlet and javax.persistence. Other than the namespace changes, Guice 6.0 & Guice 7.0 are identical.
Details
Guice 6.0 & Guice 7.0 are identical except for the namespaces they support (javax vs jakarta), and were released simultaneously. Thus, this is a changelog from 5.1.0 (not from 6.0.0) to see the meaningful differences since the last release.
See https://github.com/google/guice/compare/5.1.0...7.0.0 for a complete list of changes.
Guice Core
- Adds
jakarta.injectsupport. (devlive-community/knowforge#1630, devlive-community/knowforge#1679, devlive-community/knowforge#1490, devlive-community/knowforge#1383, with significant advice & help from many people) - Support Java 21 (via updating ASM to 9.5 and other changes). (devlive-community/knowforge#1671, devlive-community/knowforge#1657, devlive-community/knowforge#1654)
- Improve AOP support on JVMs such as Azul. (devlive-community/knowforge#1672, with significant help from @mcculls and @alsemenov)
- Fix a deadlock or crash associated with recursively loading just-in-time bindings. (devlive-community/knowforge#1633, devlive-community/knowforge#785, devlive-community/knowforge#1389, devlive-community/knowforge#1394, with significant help from @swankjesse and @PaulFridrick)
- Make
PrivateModule.binder()non-private, to allow subclass customization, such as callingskipSources. (devlive-community/knowforge#1569, devlive-community/knowforge#1525, by @visi) - Fix an endloop loop (that can OOM) in singleton lock cycle detection. (devlive-community/knowforge#1635, devlive-community/knowforge#1510, with significant help from @trancexpress and @gvisco)
- Fix tests to pass on Windows, despite the different line separator. (devlive-community/knowforge#1213)
- Improvements to OSGi metadata. (devlive-community/knowforge#1173, devlive-community/knowforge#1050, devlive-community/knowforge#1049, devlive-community/knowforge#1708 by @mcculls, @kenwenzel, and @HannesWell)
- Mark the JSR305 dependency as optional (since it's not required at runtime). (devlive-community/knowforge#1172, by @mcculls)
- Fix
Binder.requestInjection(TypeLiteral<T>, T)to use theTypeLiteral. (devlive-community/knowforge#1071, by @jedediah) - Honor scoping annotations on concrete types when provisioned by their
@ProvidedByannotation. (devlive-community/knowforge#251, devlive-community/knowforge#1319) - Add a way to tell if a class is "enhanced" by Guice, and retrieve the original class. (devlive-community/knowforge#1340, devlive-community/knowforge#187)
- Ensure the order of
bind(...)statements does not matter when referring to JIT bindings. (devlive-community/knowforge#700, devlive-community/knowforge#1650, with significant help from @nineninesevenfour) - Implement
Matcher.andandMatcher.oras default methods directly inMatcher, so that theAbstractMatchersubclass isn't required. (devlive-community/knowforge#1716, devlive-community/knowforge#1177, by @kashike) - Mark the error_prone_annotations dependency as optional. (devlive-community/knowforge#1739, by @HannesWell)
Servlet
- Fix an NPE if
contextPathis null (devlive-community/knowforge#1656, devlive-community/knowforge#1655, by @kurtseebauer)
Persist
Persist had a number of changes, some of which are backwards incompatible. Notably: injection of EntityManager no longer implicitly starts a unit of work (because this led to leaks). Users can opt-in to the legacy behavior by constructing the JpaPersistModule with a JpaPersistOptions that sets setAutoBeginWorkOnEntityManagerCreation to true.
- EntityManager provisioning no longer automatically starts a unit of work. (devlive-community/knowforge#739, devlive-community/knowforge#997, devlive-community/knowforge#730, devlive-community/knowforge#985, devlive-community/knowforge#959, devlive-community/knowforge#731)
- Ignore multiple start/stop calls, rather than throwing an exception. (devlive-community/knowforge#1214, devlive-community/knowforge#972, devlive-community/knowforge#598, by @chrisparton1991)
- Support manually initiated rollbacks. (devlive-community/knowforge#1137, devlive-community/knowforge#1136, by @Vogel612)
- Don't wrap Object-defined methods (e.g: toString, finalize, equals, hashCode) in transactions. (devlive-community/knowforge#958, devlive-community/knowforge#788, by @andresviedma)
Struts2
Guice 7.0+ does not include the struts2 extension, because struts2 does not support the jakarta.servlet namespace.
评论
登录后参与评论
KnowForge