Skip to main content
ElastiCORE 3.0 is a release candidate: 3.0.261022-rc1 on Maven Central. Projects on the 2.2 line: see the 2.2 documentation.
Version: 3.0

The runtime library

Generated code runs on elasticore-springboot3 (Spring Boot 3) or elasticore-springboot4 (Spring Boot 4). Both use the Java package io.elasticore.springboot3, so generated imports do not change between Boot versions. Upgrade it together with the generator - the same version: generated code uses runtime classes that older runtimes do not have.

Who is asking​

Class or fieldWhat
security.CurrentUser - currentUser.id(), signedIn(), hasRole("ADMIN")who is asking, as the generated services see it; the default is SessionCurrentUser, a bean of yours replaces it (Spring Security)
CurrentUser.runAsSystem(() -> ...)the application itself: every @access check passes inside it - start-up data, a nightly job
ACCESS.require(currentUser, "report")fields of the generated service: the entity's @access for an operation of your own - 401 for a visitor, 403 for who may not; an operation the line does not name is the administrator's
security.SessionCurrentUser.signIn(request, id, role), signOut(request)the session the generated sign-in uses - for a flow of your own (sign up and sign in at once)
security.AccessPolicy, security.PasswordHasherbeans you may replace (PBKDF2 is the default hasher)
// the application itself creating an administrator at start-up
CurrentUser.runAsSystem(() -> customers.save(admin));

Value types​

ClassWhat
domain.Moneythe type of a money field. Money.of("10.00"), Money.of(bigDecimal) (null for null), plus, minus, times(long), times(Quantity), times(BigDecimal), rounded(2) (half-up), toBigDecimal(), isNegative(), compareTo. plus(null) / minus(null) return the same amount. Immutable; 10 and 10.00 are equal
domain.Quantitythe type of a quantity field: never negative; minus below zero answers 422 not enough; plus, covers

A 5.5 % VAT: net.times(new java.math.BigDecimal("0.055")).rounded(2).

Refusals​

Exception (io.elasticore.springboot3.)Answer
validation.BadRequestException400
security.NotSignedInException401
security.ForbiddenException403
validation.NotFoundException (or jakarta.persistence.EntityNotFoundException)404
validation.ConflictException409
validation.InvariantViolationExceptionstate. codes 409, reference. 404, others 422
http.PortCallException502

Each takes (code, message, args...) to be translated; see API and error answers.

Plumbing you may meet​

ClassWhat
EnableElastiCoreregisters the port proxies (HTTP runtime mode, DBMS)
validation.RequestShapeErrorsthe problem+json answers before a controller - imported by the generated XxxApiErrors
validation.ErrorMessages, BeanValidationthe message lookup in the request's language, service-side validation
util.IdUtils.newId(n)the @genid id generator
entity.PersistentModelthe marker for mapping: xml domain classes (Kotlin all-open / no-arg)
domain.Lookupwhat derive(lookup) reads referenced rows with