Join Shonna Smith for an in-depth discussion in this video Controller advice, part of Spring: Spring MVC (2018).
- [Instructor] So now that we've seen…InitBinders and binder methods,…I want to show you one more thing…that you can do to apply conversions, property editing,…and all other sorts of model manipulation.…When you want to do those things…on a single controller level,…then you'll use model methods and InitBinders.…However, when you want methods like this…to apply more globally or across multiple controllers,…you have to declare them in a class that's called…a controller advice.…
By default, any method you add…to a controller advice component…will apply to every single request…for every single controller.…However, you can fine-tune the circumstances…for controller advice.…For instance, you can make sure that the advice…applies to a particular type of controller,…say a regular controller versus a rest controller.…You can make sure the advice only applies to…controllers in certain packages.…Or you can specify a particular controller…that you want this advice to apply to.…
So let's look at an example.…I've already started a class here…
- Using Spring MVC for web projects
- Spring MVC controllers
- Creating controllers and views
- Spring MVC models
- Creating the model
- Request mapping
- Spring MVC views
- Custom app configuration
Skill Level Intermediate
1. Using Spring MVC for Web Projects
2. Spring MVC Controllers
3. Spring MVC Models
4. Spring MVC Views
5. Custom App Configuration
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.