File tree Expand file tree Collapse file tree 4 files changed +11
-26
lines changed
patterns-use-cases/integrations/java-spring
src/main/java/dev/restate/examples Expand file tree Collapse file tree 4 files changed +11
-26
lines changed Original file line number Diff line number Diff line change @@ -31,10 +31,7 @@ dependencies {
3131 implementation(" org.springframework.boot" , " spring-boot-starter-data-jpa" )
3232
3333 // Restate SDK
34- implementation(" dev.restate:sdk-api:$restateVersion " )
35- implementation(" dev.restate:sdk-http-vertx:$restateVersion " )
36- // To use Jackson to read/write state entries (optional)
37- implementation(" dev.restate:sdk-serde-jackson:$restateVersion " )
34+ implementation(" dev.restate:sdk-spring-boot-starter:$restateVersion " )
3835
3936 implementation(" org.postgresql" , " postgresql" )
4037
Original file line number Diff line number Diff line change 11package dev .restate .examples ;
22
3+ import dev .restate .sdk .springboot .EnableRestate ;
34import org .springframework .boot .SpringApplication ;
45import org .springframework .boot .autoconfigure .SpringBootApplication ;
56
67@ SpringBootApplication
8+ @ EnableRestate
79public class AppMain {
810
911 public static void main (String [] args ) {
Original file line number Diff line number Diff line change 88import dev .restate .sdk .common .Serde ;
99import dev .restate .sdk .common .TerminalException ;
1010import dev .restate .sdk .serde .jackson .JacksonSerdes ;
11+ import dev .restate .sdk .springboot .RestateVirtualObject ;
1112import org .springframework .beans .factory .annotation .Autowired ;
1213import org .springframework .stereotype .Component ;
1314
14- @ Component
15- @ VirtualObject
15+ @ RestateVirtualObject
1616public class ProductService {
1717
18- @ Autowired private ProductRepository productRepository ;
18+ private static final Serde < Product > productSerde = JacksonSerdes . of ( Product . class ) ;
1919
20- private Serde <Product > productSerde = JacksonSerdes .of (Product .class );
20+ private final ProductRepository productRepository ;
21+
22+ public ProductService (ProductRepository productRepository ) {
23+ this .productRepository = productRepository ;
24+ }
2125
2226 @ Handler
2327 public Product getProductInformation (ObjectContext ctx ) {
Load Diff This file was deleted.
You can’t perform that action at this time.
0 commit comments