We're updating the issue view to help you get more done. 

ConstraintValidatorContext buildConstraintViolationWithTemplate not reading message string

Description

buildConstraintViolationWithTemplate('some message') does not work.

1 2 3 context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate("{customConstraint.duplicateName}") .addConstraintViolation();

the above code will output whatever is defined in the default message.

1 2 3 4 5 context.disableDefaultConstraintViolation(); context.buildConstraintViolationWithTemplate("{customConstraint.duplicateName}") .addPropertyNode(null).inIterable().atKey(field) .addPropertyNode("name") .addConstraintViolation();

the above code will ignore the message and default message and will out put the code with the fiull path and the name of the constraint prepended.

I wrote up a stackoverflow question here with more detail :

http://stackoverflow.com/questions/29519433/constraintvalidatorcontext-not-sending-messages

Environment

Windows 8.1 Pro
Gradle project
Spring 4.1.4

Status

Assignee

Unassigned

Reporter

BillyL

Labels

Worked in

None

Feedback Requested

None

Feedback Requested By

None

backPortable

None

Community Help Wanted

None

Suitable for new contributors

None

Requires Release Note

None

Pull Request

None

backportDecision

None

backportReEvaluate

None

Components

Affects versions

5.1.3.Final

Priority

Major