涉及微服务:
changgou_web_search:存放静态资源,实现页面跳转。
changgou_service_search:负责从ES查询数据。
changgou_service_search_api:放实体对象及feign接口。
(1)创建changgou_web_search工程
pom的引入(前端使用的是thymeleaf模板引擎)
<dependencies>
<dependency>
<groupId>com.changgou</groupId>
<artifactId>changgou_common</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>com.changgou</groupId>
<artifactId>changgou_service_search_api</artifactId>
<version>1.0-SNAPSHOT</version>
</dependency>
<!--thymeleaf模板引擎-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
</dependencies>
存放静态资源创建类:
这里注意static与templates文件夹名必须这样起,不然需要配置,麻烦!
application.yml的配置:
server:
port: 9011
spring:
application:
name: webSearch
main:
allow-bean-definition-overriding: true #当遇到同样名字的时候,是否允许覆盖注册
thymeleaf:
cache: false #thymeleaf数据缓存关闭
eureka:
client:
service