-
Notifications
You must be signed in to change notification settings - Fork 38.6k
Closed
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug
Milestone
Description
Adam McCormick opened SPR-12237 and commented
I am trying to validate service layer method arguments using the MethodValidationPostProcessor
. This is failing on, what appears to be, different the method signatures.
With an interface such as:
@Validated
public interface Service<T> {
public T create(@Valid T item);
public T update(String identifier, @Valid T item);
}
And the following implementation:
@Named
public class ItemService implements Service<Item>{
@Override
public Item create(Item item) {
return item;
}
@Override
public Item update(String identifier, Item item) {
return item;
}
}
Validation works fine when calling update(String, Item)
but throws the following exception when calling create(Item)
:
java.lang.IllegalArgumentException: HV000162: The validated type org.commons.test.validation.ItemService does not specify the constructor/method: public abstract java.lang.Object org.commons.test.validation.Service.create(java.lang.Object)
This is also working fine if Service<T>
is an abstract class and I just extend it.
Attached is a sample application that demonstrates the problem.
Affects: 4.0.6
Attachments:
- validation.zip (7.17 kB)
Referenced from: commits 7118fcf
3 votes, 8 watchers
Metadata
Metadata
Assignees
Labels
in: coreIssues in core modules (aop, beans, core, context, expression)Issues in core modules (aop, beans, core, context, expression)type: bugA general bugA general bug