Сообщения

FAANG: PromotionService design

Изображение
 Plant UML: @startuml title PromotionService - Class Diagram ' Define external User class from UserService package "UserService" {     class User {         +id: Long         +username: String         +email: String         +phone: String     } } ' Define PromotionService entities package "PromotionService" {     class PromotionPlan {         +id: UUID         +name: String         +cost: Decimal         +viewCount: Integer         +audienceScope: Enum         +durationDays: Integer         +createdAt: Timestamp         +updatedAt: Timestamp     }     class Promotion {         +id: UUID         +userId: Long         +eventId: UUID   ...

IoC:ApplicationContext, BeanFactory. Bean

 Bean - bean is an instance of a class managed by Spring Boot. In Spring Boot—and the broader Spring Framework—a bean is essentially an object that is managed by the Spring Inversion of Control (IoC) container. Beans are the backbone of a Spring application; they are the components that form the application and are responsible for performing its operations. Key Concepts: Inversion of Control (IoC): Instead of the application code controlling the flow of the program, control is inverted and given to the IoC container. This means the container is responsible for instantiating, configuring, and managing the lifecycle of beans. Dependency Injection (DI): This is a design pattern that allows an object (the client) to receive other objects it depends on (the services) from the IoC container, rather than creating them directly. Defining a Bean: In Spring Boot, you can declare beans in several ways: Using Annotations: @Component : A generic stereotype for any Spring-managed ...