0

What is the difference between creating

@Model(adaptables = Resource.class, defaultInjectionStrategy = DefaultInjectionStrategy.OPTIONAL)
public class MyModel {  }

and

public class MyModel extends WCMUsePojo { }
Riding Cave
  • 1,029
  • 1
  • 15
  • 32

1 Answers1

0

This is pretty well covered in the Sling documentation and the main advantages are:

  • convenient injection annotations for data retrieval
  • easy to extend from other Sling Models
  • simple setup for unit testing

The drawback highlighted in the documentation (lacks flexibility in terms of component overlaying, relying on service.ranking configurations) is being tackled by SLING-5992 which allows mapping a certain model implementation to a resource type.

Vlad
  • 10,602
  • 2
  • 36
  • 38