Search code examples
spring-mvcformatted

Where is Spring's @Formatted annotation?


I'm trying to define a custom formatter for my class, but I can't find the @Formatted annotation mentioned in Spring's documentation:

5.6.2 @Formatted

The @Formatted annotation allows you to easily associate a Formatter implementation with one of your classes. To use this feature, simply annotate your class as @Formatted and specify the Formatter implementation to use as the annotation value:

@Formatted(MoneyFormatter.class)
public class Money {
...
}

The example above says "Money objects should be formatted by a MoneyFormatter". With this configuation, whenever a field is of type Money, MoneyFormatter will format the field value.

I'm using maven and IntelliJ, and usually it's able to auto-import the required classes or find the required maven dependency. Neither sarching on mvnbrowser and google for Formatted gave any hint.

I can import org.springframework.format.annotation.* and org.springframework.ui.* but it's not in there.

I'm using Spring 3.*

Any suggestion?


Solution

  • You're looking at out-of-date documentation (your link is for the 3.0 RC1 release). The current documentation makes no mention of that annotation.