The contract in one module, the code in another
A Chenile service is two modules. Consumers depend only on the -api module, the contract; the -service module holds a plain Java implementation that nobody depends on, so it can change, move or be replaced.
Exchange
Payload
The same definition, written three ways
Whichever you choose, Chenile ends up with the same service definition. What differs is whether the class you wrote takes part in the request flow.
JSON service definition
Operations, URLs and parameters as data, checked against the implementation at startup. No controller class: an HTTP request lands on Chenile's own HttpEntryPoint. Nothing you wrote stands between the caller and the policies.
@ChenileController alone
A Java definition that never runs. Chenile reads it at startup and sends every call to the bean named in serviceName; the method bodies only return a placeholder for the compiler. It adds no HTTP routes, so the service is reached through proxies, events, messaging and workflows. The purest form in Java.
@ChenileController + @RestController
Defines the service and is the entry point for REST calls: an HTTP request enters the controller method, which calls process(...). Proxy, event and message calls skip it. A deliberate compromise, so that nobody writes a Chenile controller and a REST controller with the same structure.
Why Chenile accepts that compromise is in the concept. The annotations are in the annotation-based services guide and the JSON format in the service definition JSON guide.
✅ s1-api — the definition
What consumers depend on. Pure contract.
- The service interface (
S1Service) - The model objects
- No implementation, no transport, no Spring
- Packaged as a library — never deployed alone
⚙️ s1-service — the implementation
What nobody depends on. Swappable.
- A plain POJO implementing the interface
- A health checker for deep readiness probes
- Wired through a Chenile controller
- Horizontal concerns handled by policies, not code
// The whole service. Business logic and nothing else —
// no auth, no logging, no tenancy checks tangled in here.
public class S1ServiceImpl implements S1Service {
@Override
public S1Entity op1(S1Entity s1Entity) {
s1Entity.id = "S1ServiceImpl";
return s1Entity; // policies run around this, not inside it
}
}