Skip to content
Ameen Abozaid
Planned lessonJNR-010-L02

Component scanning and stereotypes

  • Lesson 2 of 6
  • Junior
On This Lesson 4 topics

This lesson is planned. The outline below lists the topics it will cover. The full lesson has not been published yet.

In this lesson

say how beans are found and which stereotype to use.

Planned topics

  • @SpringBootApplication includes component scanning of its own package and sub-packages.
  • Stereotypes: @Component generic, @Service business logic, @Repository data access, @Controller/@RestController web.
  • They all create beans; the names add meaning and some extra behavior (@Repository translates database exceptions).
  • A class outside the scanned packages is not found.
Draft outline details

Demonstration

com.shop.api.ShopApiApplication scans com.shop.api.**; a class in com.shop.other is missed.

Check your understanding

Where must the main class live?

Show answer

In the top package above all your code.

Practice

Apply this lesson with the module's lab, exercises and quiz.

Lab and exercises Quiz

Marking a lesson complete is optional and you can undo it any time. Your progress stays in this browser.

Continue to next lesson

Type to search levels, phases, modules and lessons.