赞
踩
1.引入thymeleaf依赖
- <!--模板引擎-->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-thymeleaf</artifactId>
- </dependency>
-
- <!--热部署-->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-devtools</artifactId>
- <optional>true</optional>
- </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)、修改网关
- - id: gulimall_host_route
- uri: lb://gulimall_product
- predicates:
- - Host=gulimall.com
-
- - id: gulimall_search_route
- uri: lb://gulimall_search
- predicates:
- - Host=search.gulimall.com
4.调整页面跳转逻辑
更改search的服务首页名称为list.html
添加转跳控制器SearchController
- @Controller
- public class SearchController {
-
-
- // @Autowired
- // MallSearchService mallSearchService;
-
- /**
- * 自动将页面提交过来的所有请求查询参数封装成指定的对象
- * @return
- */
- @GetMapping("/list.html")
- public String listPage(/*SearchParam param, Model model, HttpServletRequest reque
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。