Skip to main content

Code generation

Explyt Spring adds Spring-aware generators to the Generate menu (Alt+Insert, or ⌘N on macOS) and to the editor popup menu. Java and Kotlin are supported where applicable.

Generate menu

EntryWhat it produces
Spring Web MethodA Spring Web annotated method built from a URL or a cURL command. The dialog is titled Generate Spring Web Method with a single Url/Curl: field.
HttpClient MethodStandalone java.net.http.HttpClient code from a URL or cURL command — useful outside Spring, and requires Java 11 or newer.
JPA: equals() and hashCode()A proxy-safe equals/hashCode pair for a JPA entity.
Spring PostConstruct MethodA @PostConstruct lifecycle method stub.
Spring PreDestroy MethodA @PreDestroy lifecycle method stub.

Editor popup menu

EntryWhat it does
Convert Properties to YAMLConverts a .properties file to YAML.
Convert YAML to PropertiesThe reverse conversion.
Copy Full Property PathCopies the complete dotted key for the property under the caret.
Copy Property as Environment VariableCopies the key in environment variable form — server.port becomes SERVER_PORT. Handy when writing Docker Compose or Kubernetes manifests.

Copy Full Property Path and Copy Property as Environment Variable are recent additions. See Compatibility for which IDE versions include them.

Generating from a URL or cURL

Rather than hand-writing a request method, paste what you already have. Copy a cURL command from your browser's network tab or from a colleague, invoke Generate → Spring Web Method, and paste it into the Url/Curl: field. The plugin produces the annotated method with path, query parameters, headers, and body mapped to the right Spring Web constructs.

Because the result is a normal Spring Web method, it immediately gains a Run gutter icon that opens it in Swagger UI — see Swagger UI client.

JPA equals and hashCode

Generating equals and hashCode for a JPA entity is easy to get subtly wrong, because Hibernate hands you proxies and lazily-initialized instances. Field-by-field implementations, and IDE defaults that call getClass(), break as soon as a proxy is involved.

The Explyt generator follows the proxy-safe approach: the methods are final, type comparison tolerates proxies rather than requiring an exact class match, and identity rests on a non-null @Id.

OpenAPI generation

Two related actions generate OpenAPI documents from your Spring Web code:

  • Generate OpenApi Specification — a project-level action producing a specification for the whole application.
  • Generate OpenApi Doc — a gutter action on an individual controller or method.

The generated files support completion and validation, and can be executed directly through the built-in Swagger UI client.

AI-assisted generation

Beyond these deterministic generators, the Explyt AI plugin adds model-driven conversions such as entity to DTO and database schema to entity. Those are separate — see Explyt AI actions.

See also: HTTP client · Feature overview