Skip to content

Commit

Permalink
JPA Spring boot example now uses the new spring boot integration
Browse files Browse the repository at this point in the history
  • Loading branch information
slinkydeveloper committed Nov 20, 2024
1 parent ccf0452 commit b3ceb7a
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 26 deletions.
5 changes: 1 addition & 4 deletions patterns-use-cases/integrations/java-spring/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,7 @@ dependencies {
implementation("org.springframework.boot", "spring-boot-starter-data-jpa")

// Restate SDK
implementation("dev.restate:sdk-api:$restateVersion")
implementation("dev.restate:sdk-http-vertx:$restateVersion")
// To use Jackson to read/write state entries (optional)
implementation("dev.restate:sdk-serde-jackson:$restateVersion")
implementation("dev.restate:sdk-spring-boot-starter:$restateVersion")

implementation("org.postgresql", "postgresql")

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package dev.restate.examples;

import dev.restate.sdk.springboot.EnableRestate;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
@EnableRestate
public class AppMain {

public static void main(String[] args) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,20 @@
import dev.restate.sdk.common.Serde;
import dev.restate.sdk.common.TerminalException;
import dev.restate.sdk.serde.jackson.JacksonSerdes;
import dev.restate.sdk.springboot.RestateVirtualObject;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
@VirtualObject
@RestateVirtualObject
public class ProductService {

@Autowired private ProductRepository productRepository;
private static final Serde<Product> productSerde = JacksonSerdes.of(Product.class);

private Serde<Product> productSerde = JacksonSerdes.of(Product.class);
private final ProductRepository productRepository;

public ProductService(ProductRepository productRepository) {
this.productRepository = productRepository;
}

@Handler
public Product getProductInformation(ObjectContext ctx) {
Expand Down

This file was deleted.

0 comments on commit b3ceb7a

Please sign in to comment.