By degrading the version, the H2 DB is working but table i am unable to see. Code snippet
Controller
@RestController
public class CurrencyExchangeController {
@Autowired
private Environment env;
@GetMapping("/currency-exchange/from/{from}/to/{to}")
public CurrencyExchange retriveCurrencyExchange(@PathVariable String from,@PathVariable String to)
{
CurrencyExchange currencyExchange = new CurrencyExchange(1000L, from, to, BigDecimal.valueOf(65));
currencyExchange.setPort(Integer.parseInt(env.getProperty("local.server.port")));
return currencyExchange;
}
POJO
@Entity
public class CurrencyExchange {
@Id
private Long id;
@Column(name ="currency_from")
private String from;
@Column(name ="currency_to")
private String to;
@Column(name ="conversion_multiple")
private BigDecimal conversion;
private int port;
Spring boot main
@SpringBootApplication
@ComponentScan(basePackages = {"com.example"})
public class CurrencyExchangeServiceApplication {
public static void main(String[] args) throws SQLException {
SpringApplication.run(CurrencyExchangeServiceApplication.class, args);
}
app.prop
spring.application.name=currency-exchange-service
server.port=8000
spring.jpa.show-sql=true
spring.h2.console.enabled=true
data.sql file
insert into currency_exchange(id,currency_from,currency_to,conversion_multiple,port)
values(1001,'USD','INR',65,0);
insert into currency_exchange(id,currency_from,currency_to,conversion_multiple,port)
values(1002,'EUR','INR',75,0);