Udemy 課程Microservices with Spring Cloud 33
在pom檔內加入兩段,引入JPA與H2 DB
並設定application.properties
將ExchangeValue Bean改寫為Entity
在resources目錄下建立data.sql
接著執行程式
執行過程式會失敗並看到以下
是因為我們用到DB的關鍵字"from"
所以要再改造一下ExchangeValue Bean & data.sql
然後再看到
所以再改data.sql
再一次重新執行得
進到網址列:http://localhost:8087/currency-exchange/from/Hog/to/PIG
進到網址:http://localhost:8087/h2-console可以看到以下
接著使用JAP Repository
建立interface ExchangeValueRepository
在CurrencyExchangeController注入ExchangeValueRepository並使用Method
然後真的要進到合理的網址:
http://localhost:8087/currency-exchange/from/USD/to/INR