Code Explainers
Code explainers tagged #annotations
java
package com.example.config.condition; import org.springframework.context.annotation.Condition; import org.springframework.context.annotation.ConditionContext;
A custom @Conditional feature flag in Spring
conditional beans
feature flags
annotations
Intermediate
7 steps
java
@RestController @RequestMapping("/api/documents") @RequiredArgsConstructor public class DocumentController {
Method-level authorization with @PreAuthorize in Spring
authorization
spel
rest-api
Intermediate
7 steps
java
@Target(ElementType.PARAMETER) @Retention(RetentionPolicy.RUNTIME) public @interface CurrentUser { }
Injecting the current user in Spring MVC
annotations
dependency-injection
security
Intermediate
8 steps
java
public class EventBus { private final Map<Class<?>, List<Subscriber>> subscribers = new ConcurrentHashMap<>(); private final Executor executor;
Building an annotation-driven EventBus in Java
publish-subscribe
reflection
annotations
Intermediate
7 steps
python
from django.db.models import Prefetch, Count from django.views.generic import ListView from .models import Article, Comment
Building an efficient article list in Django
orm
query-optimization
prefetching
Intermediate
6 steps
java
@Target({ElementType.FIELD, ElementType.PARAMETER}) @Retention(RetentionPolicy.RUNTIME) @Constraint(validatedBy = StrongPasswordValidator.class) @Documented
Building a custom @StrongPassword validator in Spring
bean-validation
annotations
regex
Intermediate
7 steps
python
from django.db.models import Sum, Count, F, DecimalField from django.db.models.functions import TruncMonth, Coalesce from .models import Order
Build a monthly revenue report in Django
aggregation
orm
group-by
Advanced
7 steps