当前位置:   article > 正文

谷粒商城项目(学习笔记十一)_谷粒商城catalogloader文件跳转地址改不掉

谷粒商城catalogloader文件跳转地址改不掉

第八章:检索服务

一、前端整合

1.引入thymeleaf依赖

  1. <!--模板引擎-->
  2. <dependency>
  3. <groupId>org.springframework.boot</groupId>
  4. <artifactId>spring-boot-starter-thymeleaf</artifactId>
  5. </dependency>
  6. <!--热部署-->
  7. <dependency>
  8. <groupId>org.springframework.boot</groupId>
  9. <artifactId>spring-boot-devtools</artifactId>
  10. <optional>true</optional>
  11. </dependency>

关闭thymeleaf缓存

spring.thymeleaf.cache=false

2.前端页面整合

将检索服务的前端页面放置到nginx上 

修改index.html的样式地址

 3.nginx的配置

1)、修改host文件为

nginx的地址 search.gulimall.com

2)、进入conf.d修改nginx的gulimall.conf配置将静态资源转给网关

修改gulimall.com 为*.gulimall.com

3)、修改网关

  1. - id: gulimall_host_route
  2. uri: lb://gulimall_product
  3. predicates:
  4. - Host=gulimall.com
  5. - id: gulimall_search_route
  6. uri: lb://gulimall_search
  7. predicates:
  8. - Host=search.gulimall.com

4.调整页面跳转逻辑

更改search的服务首页名称为list.html

添加转跳控制器SearchController

  1. @Controller
  2. public class SearchController {
  3. // @Autowired
  4. // MallSearchService mallSearchService;
  5. /**
  6. * 自动将页面提交过来的所有请求查询参数封装成指定的对象
  7. * @return
  8. */
  9. @GetMapping("/list.html")
  10. public String listPage(/*SearchParam param, Model model, HttpServletRequest reque
本文内容由网友自发贡献,转载请注明出处:【wpsshop博客】
推荐阅读
相关标签
  

闽ICP备14008679号