Injectable Factory Method with Spring Boot

  Рет қаралды 2,730

campbelltech

campbelltech

Күн бұрын

Do you know how to implement the factory method, but you're not quite sure how to implement it when you are using dependency injection in your application? If that is you, you have come to the right place. In this video, I will show you how to make a classic factory method injectable with Spring Boot and Java.
If you do not know what the factory pattern is, or how to implement it in Java, then first watch my other video - Factory Pattern in Java: Creating Objects with Ease: • Factory Pattern in Jav...
Link to code in GitHub: github.com/sea...
#designpatterns #softwareengineer #coding #java #spring #springboot

Пікірлер: 4
@selvisokak
@selvisokak Жыл бұрын
Firstly, thank you for your effort. I have a question about the injectablity of concrete services. Why they couldn't effectively injectable at first and with what change they became injectable?
@campbelltech
@campbelltech Жыл бұрын
Thank you for your question @selvisokak. Due to the simplicity of the example used it appears as if no change is needed. However, if the concrete services had no "non-argument" constructors and only constructers with parameters/dependencies, then it would make more sense why the factory method (rather than the concrete services) would not be injectable. Meaning in the initial factory method, we explicitly instantiated the classes, so the factory method would have needed to pass those constructor parameters. Each parameter could for example be another service with it's own dependencies. In other words, it was the factory method that broke DI rather than the concrete services.
@Tecnitr0nic
@Tecnitr0nic Жыл бұрын
Service Locator is way cleaner and easy to scale
@campbelltech
@campbelltech Жыл бұрын
Thanks, we'll definetly check out Service Locator!
Injectable Factory Method in .NET
20:31
campbelltech
Рет қаралды 724
Bootiful Spring Boot by Josh Long
43:34
Devoxx
Рет қаралды 2,6 М.
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН
How to use Deepseek r1 FREE
4:33
Tech Surgeon
Рет қаралды 6
Spring Bean Factory & Application Context
13:53
Miss Xing (邢老师)
Рет қаралды 25 М.
Factory Method Pattern in Python: Creating Objects with Ease
26:55
campbelltech
Рет қаралды 3,8 М.
Understanding The Factory Design Pattern
22:40
Ryan Schachte
Рет қаралды 18 М.
Spring Cloud goes Cloud
2:10:21
Александр Бармин
Рет қаралды 37 М.
Fluent Builder in Java: Building Objects with Elegance
18:07
campbelltech
Рет қаралды 1,1 М.
Spring ultimate basics: What are Spring Beans and what is the Spring Container?
16:30
Cheerleader Transformation That Left Everyone Speechless! #shorts
00:27
Fabiosa Best Lifehacks
Рет қаралды 16 МЛН