In this video, Nick Maiorano demonstrates how to express provider/consumer dependencies using the service loader framework in Java SE with the module-info class.
- [Instructor] I'll now use the exercise files 03_06.…To use service logos within JMPS,…the chassis module info will need to be changed like this.…I've added the provides clause…that ties the interface to the concrete class.…The general syntax is provides,…name of the interface, with implementation,…or in this case com.red30tech.chassis.api.Chassis…with com.red30tech.chassis.type.SuvChassis.…
On the consumer side, the driver module info class…will be changed to express its dependency upon chassis.…Here, only the interface is specified.…Notice that I still need the requires clause…on the chassis module to access…the chassis interface itself.…Next, the test driver class will use the service loader…to obtain an instance to one of the chassis implementations.…
It can obtain the service using the static method…serviceloader.load(Chassis.class).…Now when the test driver loads the chassis implementation…it will obtain an instance to suvchassis.…I can now compile the application…and run it.…Notice that the test driver is coded defensively…
In this course, instructor Nick Maiorano breaks down this complexity by explaining what modularity is all about, how Java has adopted modularity and how to start using to build better quality applications.
- What is modularity?
- The five pillars of modularity
- Modularity in the real world
- JPMS concepts and syntax
- Designing and implementing a modular structure
- Compiling, packaging and running modular applications
- Using the dependency checking tools
- Creating custom runtime images
- Managing backward compatibility with classes and modules
- Explicit, unnamed, and automatic modules
- JPMS tips and recommendations
Skill Level Intermediate
Java Essential Training: Syntax and Structurewith David Gassner3h 9m Intermediate
1. Introduction to Modularity
2. Java Modularity through the Ages
3. Building Modular Applications with Java
4. Tools and Strategies
- 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.