Spring Core - IoC & DI
Inversion of Control, Dependency Injection, annotation (@Component, @Autowired, @Bean), scope, วงจรชีวิตของ bean
1Inversion of Control (IoC) ใน Spring คืออะไร?
Inversion of Control (IoC) ใน Spring คืออะไร?
คำตอบ
IoC คือหลักการที่ Spring framework จัดการการสร้างและวงจรชีวิตของอ็อบเจกต์แทนนักพัฒนา ซึ่งกลับด้านการควบคุมแบบดั้งเดิมที่โค้ดแอปพลิเคชันสร้างอินสแตนซ์ของ dependency โดยตรง Spring ใช้ IoC container เพื่อจัดการ bean และ dependency ของมันแบบ declarative
2bean ใน Spring คืออะไร?
bean ใน Spring คืออะไร?
คำตอบ
bean คืออ็อบเจกต์ที่ถูกจัดการโดย Spring IoC container โดย Spring จะสร้างอินสแตนซ์ กำหนดค่า และประกอบมันตามเมตาดาตาการตั้งค่า (annotation, XML หรือ Java config) bean เป็นหัวใจของแอปพลิเคชัน Spring และได้รับประโยชน์จาก dependency injection
3annotation @Component มีจุดประสงค์อะไร?
annotation @Component มีจุดประสงค์อะไร?
คำตอบ
annotation @Component ทำเครื่องหมายคลาสว่าเป็น Spring bean ที่จะถูกตรวจพบโดยอัตโนมัติระหว่าง component scanning ที่เปิดใช้งานโดย @ComponentScan Spring จะสร้างอินสแตนซ์ของคลาสนี้และวางไว้ใน IoC container ด้วยชื่อเริ่มต้น (ชื่อคลาสแบบ camelCase) นี่คือ annotation stereotype ทั่วไปที่ @Service, @Repository และ @Controller สืบทอดมาเพื่อให้ความหมายทางธุรกิจที่เฉพาะเจาะจง
dependency injection ใน Spring มีสามประเภทอะไรบ้าง?
annotation @Autowired ทำงานอย่างไร?
+19 คำถามสัมภาษณ์
หัวข้อสัมภาษณ์ Spring Boot อื่นๆ
Spring Boot Auto-Configuration
Spring Boot Starters
Application Properties & YAML
การทำ Logging ด้วย SLF4J และ Logback
Spring Boot DevTools
Spring MVC Basics
Spring REST Controllers
Request & Response Handling
การจัดการข้อยกเว้น
Bean Validation
พื้นฐาน Spring Data JPA
เอนทิตี JPA และความสัมพันธ์
การสืบค้น JPA
Spring Data Repositories
พื้นฐาน Spring Security
Spring Boot Actuator
การทดสอบหน่วยด้วย JUnit และ Mockito
การทดสอบ Spring Boot
Profiles และ Environment
RestTemplate และ WebClient
Async และ Scheduling
Caching ด้วย Spring
Spring WebFlux (Reactive)
ทรานแซกชัน Spring
การยืนยันตัวตนและการให้สิทธิ์ขั้นสูง
JWT และความปลอดภัยแบบ Stateless
OAuth2 และ Authorization Server
Spring Boot และ Docker
Microservices ด้วย Spring
Spring Cloud Config
การเพิ่มประสิทธิภาพการทำงาน
GraalVM Native Images
เชี่ยวชาญ Spring Boot สำหรับการสัมภาษณ์ครั้งถัดไป
เข้าถึงคำถามทั้งหมด flashcards แบบทดสอบเทคนิค แบบฝึกหัด code review และตัวจำลองสัมภาษณ์
เริ่มใช้ฟรี