diff --git a/spring-context/src/test/java/example/scannable/JakartaManagedBeanComponent.java b/spring-context/src/test/java/example/scannable/JakartaManagedBeanComponent.java index ffeb6c29e0..6140ea0dce 100644 --- a/spring-context/src/test/java/example/scannable/JakartaManagedBeanComponent.java +++ b/spring-context/src/test/java/example/scannable/JakartaManagedBeanComponent.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2022 the original author or authors. + * Copyright 2002-2023 the original author or authors. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -19,6 +19,6 @@ package example.scannable; /** * @author Sam Brannen */ -@jakarta.annotation.ManagedBean +@jakarta.annotation.ManagedBean("myJakartaManagedBeanComponent") public class JakartaManagedBeanComponent { } diff --git a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationBeanNameGeneratorTests.java b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationBeanNameGeneratorTests.java index 0c5e3dca87..c2d9c70efa 100644 --- a/spring-context/src/test/java/org/springframework/context/annotation/AnnotationBeanNameGeneratorTests.java +++ b/spring-context/src/test/java/org/springframework/context/annotation/AnnotationBeanNameGeneratorTests.java @@ -22,6 +22,8 @@ import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; import example.scannable.DefaultNamedComponent; +import example.scannable.JakartaManagedBeanComponent; +import example.scannable.JakartaNamedComponent; import org.junit.jupiter.api.Test; import org.springframework.beans.factory.annotation.AnnotatedBeanDefinition; @@ -63,6 +65,16 @@ class AnnotationBeanNameGeneratorTests { assertGeneratedName(ComponentWithName.class, "walden"); } + @Test + void generateBeanNameWithJakartaNamedComponent() { + assertGeneratedName(JakartaNamedComponent.class, "myJakartaNamedComponent"); + } + + @Test + void generateBeanNameWithJakartaManagedBeanComponent() { + assertGeneratedName(JakartaManagedBeanComponent.class, "myJakartaManagedBeanComponent"); + } + @Test void generateBeanNameWithCustomStereotypeComponent() { assertGeneratedName(DefaultNamedComponent.class, "thoreau");