Class DesktopEnvironmentPostProcessor

java.lang.Object
com.onec.desktop.DesktopEnvironmentPostProcessor
All Implemented Interfaces:
org.springframework.boot.env.EnvironmentPostProcessor, org.springframework.core.Ordered

public class DesktopEnvironmentPostProcessor extends Object implements org.springframework.boot.env.EnvironmentPostProcessor, org.springframework.core.Ordered
When the shell launches the JVM it passes --onec.desktop.home=<dir> pointing at the OS per-user app-data directory. In that case we relocate an embedded H2 file datasource under <home>/data so the database lives with the user's data rather than next to the binary (which, for a bundled desktop app, is read-only and ephemeral).

Runs as an EnvironmentPostProcessor because the rewrite must land before spring.datasource.url is bound. When onec.desktop.home is unset — normal bootRun/server runs — this does nothing, so dev is untouched. Bold by design: in desktop mode the relocation is unconditional, no opt-in flag.

It also keeps the user logged in across launches. Every launch starts a fresh JVM, so an in-memory HTTP session dies each time and the user would re-login. In desktop mode we persist sessions in the (now file-backed) datasource via Spring Session JDBC and hand the webview a long-lived, persistent cookie — so "stay logged in" behaves like a native app. The session defaults go in at lowest precedence, so an app can still override the timeout or cookie.

  • Constructor Details

    • DesktopEnvironmentPostProcessor

      public DesktopEnvironmentPostProcessor()
  • Method Details

    • postProcessEnvironment

      public void postProcessEnvironment(org.springframework.core.env.ConfigurableEnvironment environment, org.springframework.boot.SpringApplication application)
      Specified by:
      postProcessEnvironment in interface org.springframework.boot.env.EnvironmentPostProcessor
    • getOrder

      public int getOrder()
      Specified by:
      getOrder in interface org.springframework.core.Ordered