首页>代码>Spring Boot整合VueJS+spring data jpa实现RESTful API实例>/springboot-mockmvc-hsql/src/main/java/com/hellokoding/springboot/restful/Application.java
package com.hellokoding.springboot.restful; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; import javax.annotation.PostConstruct; import javax.annotation.Resource; import java.math.BigDecimal; @SpringBootApplication public class Application{ @Resource private StockService stockService; public static void main(String[] args) { SpringApplication.run(Application.class, args); } @PostConstruct public void init(){ Stock stock = new Stock(); stock.setId(1L); stock.setName("Stock 1"); stock.setPrice(new BigDecimal(1)); stockService.save(stock); stock.setId(2L); stock.setName("Stock 2"); stock.setPrice(new BigDecimal(2)); stockService.save(stock); stock.setId(3L); stock.setName("zuidaima"); stock.setPrice(new BigDecimal(3)); stockService.save(stock); stock.setId(4L); stock.setName("最代码"); stock.setPrice(new BigDecimal(4.55)); stockService.save(stock); stock.setId(5L); stock.setName("最代码官方"); stock.setPrice(new BigDecimal(6.55)); stockService.save(stock); stock.setId(6L); stock.setName("zuidaima.com"); stock.setPrice(new BigDecimal(7.55)); stockService.save(stock); } }
最近下载更多