日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

搭建商品详情页工程

發布時間:2024/4/13 编程问答 31 豆豆
生活随笔 收集整理的這篇文章主要介紹了 搭建商品详情页工程 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

商品詳情

當用戶搜索到商品,肯定會點擊查看,就會進入商品詳情頁,接下來我們完成商品詳情頁的展示,

Thymeleaf

在商品詳情頁中,我們會使用到Thymeleaf來渲染頁面,所以需要先了解Thymeleaf的語法。

?

商品詳情頁服務

商品詳情瀏覽量比較大,并發高,我們會獨立開啟一個微服務,用來展示商品詳情。

創建module

商品的詳情頁服務,命名為:learn-goods-web

pom依賴

<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0"xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"><parent><artifactId>learn</artifactId><groupId>com.learn.parent</groupId><version>1.0.0-SNAPSHOT</version></parent><modelVersion>4.0.0</modelVersion><groupId>com.learn.goods</groupId><artifactId>learn-goods-web</artifactId><version>1.0.0-SNAPSHOT</version><dependencies><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-netflix-eureka-client</artifactId></dependency><dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-openfeign</artifactId></dependency><dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-thymeleaf</artifactId></dependency><dependency><groupId>com.learn.item</groupId><artifactId>learn-item-interface</artifactId><version>1.0.0-SNAPSHOT</version></dependency></dependencies> </project>

編寫啟動類

@SpringBootApplication @EnableDiscoveryClient @EnableFeignClients public class LeyouGoodsWebApplication {public static void main(String[] args) {SpringApplication.run(LeyouGoodsWebApplication.class, args);} }

application.yml文件

server:port: 8084 spring:application:name: goods-webthymeleaf:cache: false eureka:client:service-url:defaultZone: http://127.0.0.1:10086/eurekainstance:lease-renewal-interval-in-seconds: 5 # 每隔5秒發送一次心跳lease-expiration-duration-in-seconds: 10 # 10秒不發送就過期

頁面模板

我們從learn-portal中復制item.html模板到當前項目resource目錄下的templates中:

總結

以上是生活随笔為你收集整理的搭建商品详情页工程的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。