on ‎2019 Mar 18 7:00 AM
I am using @Jsonformat to specify a date format for my attribute. But there is one problem that @Jsonformat usage SimpleDateFormat which accepts date as 32 jan. But it will calculate and assume date to be 1 Feb. I don't want this to happen. So I was planning to create a new annotation which will handle it and will not auto adjust anything. I can create a new annotaion and use it in my bean class but how can I write handler/serializer whatever we write to specify how operation will be performed?
Request clarification before answering.
Hi - you need to define your custom annotation and then write a custom BeanPostProcessor so that Spring can recognize it e.g. https://www.baeldung.com/spring-annotation-bean-pre-processor
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Yes I have checked all the mentioned url's and thank you for that. But in all exaple you are using getAnnotation in main method. This is not how its done in spring right? Say @requestParam will simply pick value corrosponding to that attribute but we dont write that logic in controller. Its completely hidden. That is what I want.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 | |
| 1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.