Installation#
Three things to do: add the dependency, import the configuration class, and confirm it works with a one-class endpoint.
1. Add the dependency#
Gradle#
repositories {
mavenCentral()
maven { url "https://repo.palmyralabs.com/releases" }
}
dependencies {
implementation 'com.palmyralabs.palmyra:palmyra-spring:1.4.4'
}Maven#
<repositories>
<repository>
<id>palmyralabs</id>
<url>https://repo.palmyralabs.com/releases</url>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.palmyralabs.palmyra</groupId>
<artifactId>palmyra-spring</artifactId>
<version>1.4.4</version>
</dependency>
</dependencies>2. Import the Palmyra configuration#
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Import;
import com.palmyralabs.palmyra.spring.PalmyraSpringConfiguration;
@SpringBootApplication
@Import(PalmyraSpringConfiguration.class)
public class App {
public static void main(String[] args) { SpringApplication.run(App.class, args); }
}That’s the entire framework hook-up — every Palmyra-annotated handler in the application is now scanned and routed.
3. Verify with a minimal endpoint#
Create a table:
CREATE TABLE app_user (
id BIGINT AUTO_INCREMENT PRIMARY KEY,
login_name VARCHAR(128) NOT NULL UNIQUE
);A minimal model:
import com.palmyralabs.palmyra.base.annotations.PalmyraField;
import com.palmyralabs.palmyra.base.annotations.PalmyraType;
@PalmyraType(type = "User", table = "app_user")
public class UserModel {
@PalmyraField(primaryKey = true) private Long id;
@PalmyraField(sort = true, search = true) private String loginName;
// getters / setters or Lombok
}A minimal handler:
import org.springframework.stereotype.Component;
import com.palmyralabs.palmyra.base.annotations.CrudMapping;
import com.palmyralabs.palmyra.handlers.CreateHandler;
import com.palmyralabs.palmyra.handlers.QueryHandler;
@Component
@CrudMapping(mapping = "/user", type = UserModel.class, secondaryMapping = "/user/{id}")
public class UserHandler implements QueryHandler, CreateHandler { }Boot the app and call the endpoint:
curl -s 'http://localhost:8080/user'{ "result": [], "limit": 15, "offset": 0 }A POST inserts:
curl -sX POST http://localhost:8080/user \
-H 'Content-Type: application/json' \
-d '{ "loginName": "ada@example.com" }'Two annotations and an interface composition gave you a paginated list and an insert endpoint with no hand-written SQL or controller logic.
Where next#
- Build the full two-entity app step by step in My First Application — adds a foreign key, more handlers, a Mantine UI, and a worked example you can run end-to-end.
- Browse the per-annotation, per-handler reference pages under Reference → Backend.