Spring Boot Microservice Configure JPA and intialize Data

 STEP 1. Add Given below dependacny in your currencyExchangeService Project


<dependency>

<groupId>org.springframework.boot</groupId>

<artifactId>spring-boot-starter-data-jpa</artifactId>

</dependency>

<dependency>

<groupId>com.h2database</groupId>

<artifactId>h2</artifactId>

</dependency>


 STEP 2. Now Convert your POJO to @Entity Annotation to Entity class and @Id at data member

@Entity

public class ExchangeValue {


@Id

private Long id;

private String from;

private String to;

private BigDecimal conversionMultiple;

private int port;


//Getter/Setter

//Constructor

}


 STEP 2. Create Database using file sql file data.sql in your resource folder



Comments

Popular posts from this blog

Setup Client Side Load Balancing With Ribbon

STEP 05 Installing GIT

Create a JPA Repository