File tree Expand file tree Collapse file tree 3 files changed +52
-0
lines changed
main/java/org/example/myapp/config
test/java/org/example/myapp/config Expand file tree Collapse file tree 3 files changed +52
-0
lines changed Original file line number Diff line number Diff line change
1
+ package org .example .myapp .config ;
2
+
3
+ import io .avaje .inject .Bean ;
4
+ import io .avaje .inject .Factory ;
5
+
6
+ @ Factory
7
+ public class DupShortNameFactory {
8
+
9
+ @ Bean
10
+ MyDup one () {
11
+ return new MyDup ();
12
+ }
13
+
14
+ /**
15
+ * Requires fully qualified name as short name of MyDup clashes.
16
+ */
17
+ @ Bean
18
+ org .example .myapp .config .MyDup two () {
19
+ return new org .example .myapp .config .MyDup ();
20
+ }
21
+
22
+ public static class MyDup {
23
+
24
+ }
25
+ }
Original file line number Diff line number Diff line change
1
+ package org .example .myapp .config ;
2
+
3
+ public class MyDup {
4
+ }
Original file line number Diff line number Diff line change
1
+ package org .example .myapp .config ;
2
+
3
+ import io .avaje .inject .BeanScope ;
4
+ import org .junit .jupiter .api .Test ;
5
+
6
+ import static org .assertj .core .api .Assertions .assertThat ;
7
+ import static org .junit .jupiter .api .Assertions .*;
8
+
9
+ class DupShortNameFactoryTest {
10
+
11
+ @ Test
12
+ void factoryBeanRequiringFullyQualifiedName () {
13
+ try (BeanScope testScope = BeanScope .builder ().build ()) {
14
+ // both have short name of MyDup
15
+ var one = testScope .get (org .example .myapp .config .MyDup .class );
16
+ var two = testScope .get (DupShortNameFactory .MyDup .class );
17
+
18
+ assertNotNull (one );
19
+ assertNotNull (two );
20
+ assertThat (one ).isNotSameAs (two );
21
+ }
22
+ }
23
+ }
You can’t perform that action at this time.
0 commit comments