Configuration classes let you centralize and apply global settings at startup. Any class annotated with @Config and implementing ConfigInterface is automatically discovered by the framework — no manual registration needed.
@Config
public class NotifConfig implements ConfigInterface {
@Override
public void configure() {
FlashConfig.setDuration(5000);
// Options: top-right, top-left, bottom-right,
// bottom-left, top-center, bottom-center
FlashConfig.setPosition("top-right");
FlashConfig.setCustomCSS("""
.flash-notification {
border-radius: 1rem;
font-size: 0.875rem;
}
.flash-success {
background: linear-gradient(to right, #10b981, #059669);
}
""");
}
}
You can have multiple @Config classes — each is discovered and executed at startup. Keep them focused on a single concern (e.g. one for flash, one for storage).