Core concepts
Components
Java classes with an interface. Compose them into a tree, pass inputs, and let Spring provide the dependencies.
Browse documentation
Define a component
Use dev.isira.jaspring.component.Component to register a selector, template, and optional stylesheet. Jaspring creates component instances per live page through Spring’s bean factory. They are not shared singleton UI objects.
import dev.isira.jaspring.component.Component;
import dev.isira.jaspring.component.Input;
@Component(selector = "app-greeting",
templateUrl = "greeting.component.html",
styleUrl = "greeting.component.css")
public class GreetingComponent {
@Input public String name = "world";
}
Inputs and composition
A parent uses a child’s selector as an HTML element. Bind a property to pass an input. Components, pipes, and directives discovered by the application are currently available globally; Angular’s standalone imports lists are not enforced.
<section>
<app-greeting [name]="displayName()"></app-greeting>
</section>
<!-- Inside greeting.component.html -->
<h2>Hello, {{ name }}.</h2>
<ng-content></ng-content>
Send values to the parent
Create an OutputEmitter with Signals.output() and annotate it with @Output. Emitting a value invokes the parent’s bound handler during the current page turn.
import dev.isira.jaspring.component.Output;
import dev.isira.jaspring.signals.OutputEmitter;
import dev.isira.jaspring.signals.Signals;
@Output public final OutputEmitter<String> saved = Signals.output();
public void save() {
saved.emit("Saved");
}
// Parent template:
// <app-editor (saved)="onSaved($event)"></app-editor>
Work with the lifecycle
Implement lifecycle interfaces from dev.isira.jaspring.cd.lifecycle, such as OnInit, OnChanges, AfterViewInit, and OnDestroy. Their methods use familiar names like ngOnInit() and ngOnDestroy().
Use initialization to load component data and destruction to release owned resources. Constructor injection works for services. When work should complete after the first response, use the page’s Zone.fork API so the continuation runs inside a valid turn.