@@ -395,14 +395,10 @@ Set<AnnotationInstance> getAnnotationsToAdd(
395
395
Collections .singletonList ((AnnotationValue .createStringValue ("value" , value )))));
396
396
}
397
397
}
398
-
399
- // in Spring List<SomeBean> means that all instances of SomeBean should be injected
400
- if (fieldInfo .type ().name ().equals (DotNames .LIST )) {
401
- annotationsToAdd .add (create (
402
- QUARKUS_ALL_ANNOTATION ,
403
- target ,
404
- Collections .emptyList ()));
405
- }
398
+ addAllAnnotationOnListField (target , annotationsToAdd , fieldInfo );
399
+ } else if (fieldInfo .hasAnnotation (CDI_INJECT_ANNOTATION )) {
400
+ // Mix case of JSR-303 support in Spring
401
+ addAllAnnotationOnListField (target , annotationsToAdd , fieldInfo );
406
402
} else if (fieldInfo .hasAnnotation (SPRING_VALUE_ANNOTATION )) {
407
403
final AnnotationInstance annotation = fieldInfo .annotation (SPRING_VALUE_ANNOTATION );
408
404
addSpringValueAnnotations (target , annotation , true , annotationsToAdd );
@@ -437,18 +433,11 @@ Set<AnnotationInstance> getAnnotationsToAdd(
437
433
CDI_INJECT_ANNOTATION ,
438
434
target ,
439
435
Collections .emptyList ()));
440
- // in Spring List<SomeBean> means that all instances of SomeBean should be injected
441
- List <Type > parameters = methodInfo .parameterTypes ();
442
- for (int i = 0 ; i < parameters .size (); i ++) {
443
- Type parameter = parameters .get (i );
444
- if (parameter .name ().equals (DotNames .LIST )) {
445
- annotationsToAdd .add (create (
446
- QUARKUS_ALL_ANNOTATION ,
447
- MethodParameterInfo .create (methodInfo , (short ) i ),
448
- Collections .emptyList ()));
449
- }
450
- }
436
+ addAllAnnotationOnMethodListParameters (annotationsToAdd , methodInfo );
451
437
438
+ } else if (methodInfo .hasAnnotation (CDI_INJECT_ANNOTATION )) {
439
+ // Mix case of JSR-303 support in Spring
440
+ addAllAnnotationOnMethodListParameters (annotationsToAdd , methodInfo );
452
441
}
453
442
454
443
// add method parameter conversion annotations
@@ -473,6 +462,31 @@ Set<AnnotationInstance> getAnnotationsToAdd(
473
462
return annotationsToAdd ;
474
463
}
475
464
465
+ private void addAllAnnotationOnListField (AnnotationTarget target , Set <AnnotationInstance > annotationsToAdd ,
466
+ FieldInfo fieldInfo ) {
467
+ // in Spring List<SomeBean> means that all instances of SomeBean should be injected
468
+ if (fieldInfo .type ().name ().equals (DotNames .LIST )) {
469
+ annotationsToAdd .add (create (
470
+ QUARKUS_ALL_ANNOTATION ,
471
+ target ,
472
+ Collections .emptyList ()));
473
+ }
474
+ }
475
+
476
+ private void addAllAnnotationOnMethodListParameters (Set <AnnotationInstance > annotationsToAdd , MethodInfo methodInfo ) {
477
+ // in Spring List<SomeBean> means that all instances of SomeBean should be injected
478
+ List <Type > parameters = methodInfo .parameterTypes ();
479
+ for (int i = 0 ; i < parameters .size (); i ++) {
480
+ Type parameter = parameters .get (i );
481
+ if (parameter .name ().equals (DotNames .LIST )) {
482
+ annotationsToAdd .add (create (
483
+ QUARKUS_ALL_ANNOTATION ,
484
+ MethodParameterInfo .create (methodInfo , (short ) i ),
485
+ Collections .emptyList ()));
486
+ }
487
+ }
488
+ }
489
+
476
490
/**
477
491
* Meant to be called with instances of @Component, @Service, @Repository
478
492
*/
0 commit comments