General upgrade to Jakarta EE 11 APIs
Includes removal of ManagedBean and javax.annotation legacy support. Includes AbstractJson(Http)MessageConverter revision for Yasson 3.0. Includes initial Hibernate ORM 7.0 upgrade. Closes gh-34011 Closes gh-33750
This commit is contained in:
@@ -103,8 +103,6 @@ import org.springframework.util.StringUtils;
|
||||
*
|
||||
* <p>Also supports the common {@link jakarta.inject.Inject @Inject} annotation,
|
||||
* if available, as a direct alternative to Spring's own {@code @Autowired}.
|
||||
* Additionally, it retains support for the {@code javax.inject.Inject} variant
|
||||
* dating back to the original JSR-330 specification (as known from Java EE 6-8).
|
||||
*
|
||||
* <h3>Autowired Constructors</h3>
|
||||
* <p>Only one constructor of any given bean class may declare this annotation with
|
||||
@@ -189,8 +187,8 @@ public class AutowiredAnnotationBeanPostProcessor implements SmartInstantiationA
|
||||
/**
|
||||
* Create a new {@code AutowiredAnnotationBeanPostProcessor} for Spring's
|
||||
* standard {@link Autowired @Autowired} and {@link Value @Value} annotations.
|
||||
* <p>Also supports the common {@link jakarta.inject.Inject @Inject} annotation,
|
||||
* if available, as well as the original {@code javax.inject.Inject} variant.
|
||||
* <p>Also supports the common {@link jakarta.inject.Inject @Inject} annotation
|
||||
* if available.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public AutowiredAnnotationBeanPostProcessor() {
|
||||
@@ -206,15 +204,6 @@ public class AutowiredAnnotationBeanPostProcessor implements SmartInstantiationA
|
||||
catch (ClassNotFoundException ex) {
|
||||
// jakarta.inject API not available - simply skip.
|
||||
}
|
||||
|
||||
try {
|
||||
this.autowiredAnnotationTypes.add((Class<? extends Annotation>)
|
||||
ClassUtils.forName("javax.inject.Inject", classLoader));
|
||||
logger.trace("'javax.inject.Inject' annotation found and supported for autowiring");
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
// javax.inject API not available - simply skip.
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -33,14 +33,10 @@ class JakartaAnnotationsRuntimeHints implements RuntimeHintsRegistrar {
|
||||
|
||||
@Override
|
||||
public void registerHints(RuntimeHints hints, @Nullable ClassLoader classLoader) {
|
||||
// javax.inject.Provider is omitted from the list, since we do not currently load
|
||||
// it via reflection.
|
||||
Stream.of(
|
||||
"jakarta.inject.Inject",
|
||||
"jakarta.inject.Provider",
|
||||
"jakarta.inject.Qualifier",
|
||||
"javax.inject.Inject",
|
||||
"javax.inject.Qualifier"
|
||||
"jakarta.inject.Qualifier"
|
||||
).forEach(typeName -> hints.reflection().registerType(TypeReference.of(typeName)));
|
||||
}
|
||||
|
||||
|
||||
@@ -47,8 +47,7 @@ import org.springframework.util.ObjectUtils;
|
||||
* against {@link Qualifier qualifier annotations} on the field or parameter to be autowired.
|
||||
* Also supports suggested expression values through a {@link Value value} annotation.
|
||||
*
|
||||
* <p>Also supports JSR-330's {@link jakarta.inject.Qualifier} annotation (as well as its
|
||||
* pre-Jakarta {@code javax.inject.Qualifier} equivalent), if available.
|
||||
* <p>Also supports JSR-330's {@link jakarta.inject.Qualifier} annotation if available.
|
||||
*
|
||||
* @author Mark Fisher
|
||||
* @author Juergen Hoeller
|
||||
@@ -69,8 +68,7 @@ public class QualifierAnnotationAutowireCandidateResolver extends GenericTypeAwa
|
||||
/**
|
||||
* Create a new {@code QualifierAnnotationAutowireCandidateResolver} for Spring's
|
||||
* standard {@link Qualifier} annotation.
|
||||
* <p>Also supports JSR-330's {@link jakarta.inject.Qualifier} annotation (as well as
|
||||
* its pre-Jakarta {@code javax.inject.Qualifier} equivalent), if available.
|
||||
* <p>Also supports JSR-330's {@link jakarta.inject.Qualifier} annotation if available.
|
||||
*/
|
||||
@SuppressWarnings("unchecked")
|
||||
public QualifierAnnotationAutowireCandidateResolver() {
|
||||
@@ -82,13 +80,6 @@ public class QualifierAnnotationAutowireCandidateResolver extends GenericTypeAwa
|
||||
catch (ClassNotFoundException ex) {
|
||||
// JSR-330 API (as included in Jakarta EE) not available - simply skip.
|
||||
}
|
||||
try {
|
||||
this.qualifierTypes.add((Class<? extends Annotation>) ClassUtils.forName("javax.inject.Qualifier",
|
||||
QualifierAnnotationAutowireCandidateResolver.class.getClassLoader()));
|
||||
}
|
||||
catch (ClassNotFoundException ex) {
|
||||
// JSR-330 API not available - simply skip.
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -508,8 +508,8 @@ public class RootBeanDefinition extends AbstractBeanDefinition {
|
||||
|
||||
/**
|
||||
* Register an externally managed configuration initialization method —
|
||||
* for example, a method annotated with JSR-250's {@code javax.annotation.PostConstruct}
|
||||
* or Jakarta's {@link jakarta.annotation.PostConstruct} annotation.
|
||||
* for example, a method annotated with Jakarta's
|
||||
* {@link jakarta.annotation.PostConstruct} annotation.
|
||||
* <p>The supplied {@code initMethod} may be a
|
||||
* {@linkplain Method#getName() simple method name} or a
|
||||
* {@linkplain org.springframework.util.ClassUtils#getQualifiedMethodName(Method)
|
||||
|
||||
@@ -63,14 +63,4 @@ class JakartaAnnotationsRuntimeHintsTests {
|
||||
assertThat(RuntimeHintsPredicates.reflection().onType(Qualifier.class)).accepts(this.hints);
|
||||
}
|
||||
|
||||
@Test // gh-33345
|
||||
void javaxInjectAnnotationHasHints() {
|
||||
assertThat(RuntimeHintsPredicates.reflection().onType(javax.inject.Inject.class)).accepts(this.hints);
|
||||
}
|
||||
|
||||
@Test // gh-33345
|
||||
void javaxQualifierAnnotationHasHints() {
|
||||
assertThat(RuntimeHintsPredicates.reflection().onType(javax.inject.Qualifier.class)).accepts(this.hints);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user