tinycodinglm / lang /lang-0045.jsonl
winapiadmin's picture
Upload folder using huggingface_hub (part 15)
b27bfb3 verified
|
Raw History Blame Contribute Delete
1.45 kB
opencode trace
System You are an expert software engineer.

You are an expert software engineer.

User

How does the Spring Framework work internally?

Assistant

Spring IoC (Inversion of Control): container manages object lifecycle and dependencies.

ApplicationContext: central interface for Spring.

  • ClassPathXmlApplicationContext: XML-based
  • AnnotationConfigApplicationContext: annotation-based
  • GenericWebApplicationContext: web-based

Bean lifecycle:

  1. Instantiation (constructor or factory method)
  2. Populate properties (dependency injection)
  3. BeanNameAware, BeanFactoryAware
  4. BeanPostProcessor.postProcessBeforeInitialization
  5. @PostConstruct / InitializingBean.afterPropertiesSet
  6. BeanPostProcessor.postProcessAfterInitialization (AOP proxy creation)
  7. Ready to use
  8. @PreDestroy / DisposableBean.destroy

AOP (Aspect-Oriented Programming):

  • JDK dynamic proxies: interfaces
  • CGLIB proxies: subclasses
  • @Around, @Before, @After, @AfterReturning, @AfterThrowing

Transaction management:

  • @Transactional: declarative transactions
  • PlatformTransactionManager: programmatic
  • Propagation: REQUIRED, REQUIRES_NEW, NESTED
  • Isolation: READ_COMMITTED, REPEATABLE_READ, SERIALIZABLE