What it is. Spring is an application framework built on IoC, Inversion of Control: the container creates objects and wires them together; your code does not call new for its collaborators. Quarkus is a Java framework aimed at containers and cloud-native deployment: it moves work Spring does at run time to build time, so the application starts fast and uses little memory.
IoC and DI. Inversion of Control means the framework owns object creation and assembly. Dependency Injection is the mechanism: a bean declares what it needs, usually in its constructor, and the container supplies it. Constructor injection is preferred: the dependency is visible, the object is complete after construction, and it is easy to test with a fake. Field injection hides the dependency and makes testing harder.
The container and the bean lifecycle. The ApplicationContext reads bean definitions and runs each bean through: instantiate, populate properties, aware callbacks (BeanNameAware and friends), BeanPostProcessor before-initialization, the init method (@PostConstruct or afterPropertiesSet), ready to serve, and finally the destroy method (@PreDestroy) at shutdown. Scopes: singleton is the default (one instance per container); prototype makes a new instance per request; request and session scopes live in web applications.
AOP proxy and the @Transactional self-call trap. AOP, Aspect-Oriented Programming, puts cross-cutting concerns (transactions, logging, security) into aspects instead of scattering them through business code. Spring applies them with proxies: a JDK dynamic proxy when the bean implements an interface, CGLIB subclassing otherwise. @Transactional works through the proxy — the proxy starts the transaction, then calls the real method. A call from inside the same bean (this.otherMethod()) never passes the proxy, so no transaction starts and the annotation silently does nothing. The fix is to call through the proxy: inject the bean into itself, or move the method to another bean.
Spring Boot. Starter: a curated dependency set — spring-boot-starter-web brings Tomcat plus Spring MVC in one declaration. Auto-configuration: the framework adds beans conditionally, based on what is on the classpath (@ConditionalOnClass, @ConditionalOnMissingBean), so a web application gets a web server without explicit configuration. Embedded server: Tomcat, Jetty, or Undertow runs inside the jar; the application starts with java -jar. Startup flow: SpringApplication.run builds the environment, creates the ApplicationContext, runs auto-configuration, starts the embedded server, then runs CommandLineRunner and ApplicationRunner beans.
Annotations, each in detail. Stereotype: @Component marks a class as a bean; @Service is a component in the service layer; @Repository is a component in the data layer (and translates persistence exceptions); @Controller is a component that handles web requests; @RestController is a controller whose methods return response bodies directly. Injection: @Autowired asks the container to inject a dependency; @Qualifier picks one bean when several match; @Value injects a configuration value; @Configuration marks a class as a source of bean definitions; @Bean marks a method whose return value is a bean; @ComponentScan says where to look for components; @Primary says which bean wins when several match. Configuration: @ConfigurationProperties binds a group of properties to a typed object. Web: @RequestMapping maps a path to a method; @GetMapping and @PostMapping are shortcuts for GET and POST; @RequestParam binds a query parameter; @PathVariable binds a path segment; @RequestBody binds the request body; @ResponseBody writes the return value as the response body. Transaction: @Transactional marks a method as transactional, with propagation (how it joins an existing transaction), isolation (how it sees other transactions' work), and rollbackFor (which exceptions trigger rollback). Lifecycle: @PostConstruct runs after injection, @PreDestroy runs before shutdown. Conditional: @ConditionalOnClass adds a bean only when a class is present; @ConditionalOnMissingBean adds it only when no other bean of that type exists; @EnableAutoConfiguration switches auto-configuration on.
Quarkus, the comparison. Spring resolves wiring at run time through reflection: flexible, but startup is slow and memory use is high. Quarkus does dependency injection, configuration, and much of its processing at build time, under a closed-world assumption: it knows the whole application when it builds. The result is fast startup and low memory, and a GraalVM native image is possible. The trade: Spring's run-time dynamism (anything can be added at run time) against Quarkus's build-time constraints (what is not known at build time cannot be done).
CDI. CDI is Contexts and Dependency Injection, the Jakarta EE standard for dependency injection. It is the spec; Spring's DI is Spring's own implementation of the same idea, and Quarkus implements CDI through Arc. Its pieces: @Inject for injection, scopes such as @ApplicationScoped and @RequestScoped, producers (@Produces) for beans the container cannot create itself, events for decoupled notification, interceptors for cross-cutting behavior. CDI is not CDN: CDN is Content Delivery Network, a way to serve static files from nearby servers — a different thing entirely.