- Cloud-Native Applications in Java
- Ajay Mahajan Munish Kumar Gupta Shyam Sundar
- 261字
- 2021-06-24 19:07:16
Running the service
There are many ways to run the service.
Right-click on the project and select Run As | Maven build and configure the Run Configurations to execute the spring-boot:run target as follows:

On clicking Run, if the internet connection and configuration are fine, you will see the following console output:
[INFO] Building product 0.0.1-SNAPSHOT ... [INFO] Changes detected - recompiling the module! [INFO] Compiling 3 source files to C:Appswkneonproducttargetclasses ... :: Spring Boot :: (v1.4.3.RELEASE) 2016-10-28 13:41:16.714 INFO 2532 --- [ main] com.mycompany.product.ProductSpringApp : Starting ProductSpringApp on L-156025577 with PID 2532 (C:Appswkneonproducttargetclasses started by MAHAJAN in C:Appswkneonproduct) ... 2016-10-28 13:41:19.892 INFO 2532 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http) ... 2016-10-28 13:41:21.201 INFO 2532 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/product/{id}]}" onto com.mycompany.product.Product com.mycompany.product.ProductService.getProduct(int) 2016-10-28 13:41:21.202 INFO 2532 --- [ main] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/productIds]}" onto java.util.List<java.lang.Integer> com.mycompany.product.ProductService.getProductIds(int) ... ... 2016-10-28 13:41:21.915 INFO 2532 --- [ main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat started on port(s): 8080 (http) 2016-10-28 13:41:21.922 INFO 2532 --- [ main] com.mycompany.product.ProductSpringApp : Started ProductSpringApp in 6.203 seconds (JVM running for 14.199)
Note the stages of the Maven execution:
- First, the Maven task compiles all the Java files. We have three simple Java classes as of now.
- The next step runs it as an application, where a Tomcat instance starts.
- Note the mapping of the URLs /product/ and /productIds to the Bean methods.
- Tomcat listens on port 8080 for service requests.
You can also run the service by just right-clicking the class that has the main method (ProductSpringApp) in Package Explorer and then selecting Run As | Java Application.
推薦閱讀
- React進階之路
- 輕松學iPhone開發(fā)
- Android板級支持與硬件相關子系統(tǒng)
- RFID 重大工程與國家物聯(lián)網(wǎng)(第3版)
- 無線通信中的空時與協(xié)作信號處理
- 數(shù)字平板電視機維修筆記
- 數(shù)字新基建的大動脈:光纜技術(shù)革新與管線施工
- 5G大規(guī)模天線增強技術(shù)
- 數(shù)字視頻處理與顯示
- 電子裝配工技能實訓與考核指導(中、高級工)
- 微信公眾平臺與小程序開發(fā):從零搭建整套系統(tǒng)(第2版)
- TD-SCDMA無線網(wǎng)絡創(chuàng)新技術(shù)與應用
- 深入淺出通信原理
- 5G網(wǎng)絡建設實踐與模式創(chuàng)新
- Protel DXP 2004入門與提高