Example app: beanguard-demo

beanguard-demo is a small, runnable Spring Boot app in the same repository as beanguard-client — the fastest way to see a full integration (fetching a licence, reading its status, refreshing, extending, transferring) working before you wire one into your own app.

Running it

You need a running beanguard-server (see Quick start) and its licence public key and AES secret from Cryptographic keys in the admin panel:

BEANGUARD_SERVER_PUBLIC_KEY="..." \
BEANGUARD_SERVER_SECRET_KEY="..." \
mvn -pl beanguard-demo spring-boot:run

Then open http://localhost:8090. The server address (beanguard.demo.server.url, default http://localhost:8000) and the port can be changed in beanguard-demo/src/main/resources/application.yml instead of via environment variables if you prefer.

Persistence profiles

ProfileBehaviour
memory (default)The licence key/secret and any pending transfer live only in memory — restarting the app clears them and the demo licence form reappears.
filePersisted to ./beanguard-demo-data/ (relative to the working directory) — survives restarts.

Switch profiles with --spring.profiles.active=file, or edit spring.profiles.active in application.yml.

What you can test

  1. Get a demo licence — with no licence loaded, the app shows a form asking for an email and VAT/NIP number. Submitting it calls the server's self-service endpoint, which issues a DEMO licence (see Demo licences) and immediately displays its claims, expiration, and key.
  2. Refresh — re-fetches the current licence from the server on demand, instead of waiting for beanguard-client's hourly automatic refresh. Useful right after editing claims or extending the licence from the admin panel.
  3. Extend — redirects into beanguard-shop carrying the licence's identity, the same path an end customer follows to buy an extension.
  4. Transfer to a new machine — the empty-state screen also has a second form for entering an existing licence key, simulating a reinstall (or recovering a memory-profile licence lost on restart). The server emails a confirmation link — if you're running the server's own docker-compose.yml, check Mailpit for it — that has to be opened once; then click Check status on the demo page to pick up the new secret.

Where to look in the code

  • FileBeanGuardConfiguration / InMemoryBeanGuardConfiguration (dev.beanguard.demo.licence) — the two BeanGuardConfiguration implementations behind the file/memory profiles. Compare them to the Implementing BeanGuardConfiguration example.
  • DemoController — the only class talking to LicenceRegistry and BeanGuardServer directly; a template for the Reading licence status pattern in your own app.

Was this page helpful?