Spring Boot automatically resolves message keys in javax and hibernate annotation annotations

I wrote a Spring boot application. I wanted to know that Spring Boot automatically resolves message keys in javax and hibernate annotation annotations. For instance:

@NotEmpty(message = "${message.key}")
String name;

I presented @PropertySourcein my application with a message properties file, and the file is also in my class path. Keys are resolved with the help @Value, but they are not allowed in the annotations check.

What could be the reason for this?

Do I need to configure a bean message source? Since I saw examples of work without setting the bean message source.

+4
source share
1 answer

? Spring MessageSource bean , src/main/resources/messages.properties. hibernate-validator , .

@PropertySource , , , . ^^

+3

Source: https://habr.com/ru/post/1652491/


All Articles