京淘項目前端實現

1. 京淘前端架構設計

在這裏插入圖片描述

2. JT-WEB項目建立

2.1 構建JT-WEB

在這裏插入圖片描述

2.2 添加繼承/依賴/插件

<?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>jt</artifactId>
        <groupId>com.jt</groupId>
        <version>1.0-SNAPSHOT</version>
    </parent>
    <modelVersion>4.0.0</modelVersion>
    <artifactId>jt-web</artifactId>
    <!--因爲添加的是動態web資源因此打包暫時用war-->
    <packaging>war</packaging>

    <!--添加依賴-->
    <dependencies>
        <dependency>
            <groupId>com.jt</groupId>
            <artifactId>jt-common</artifactId>
            <version>1.0-SNAPSHOT</version>
        </dependency>
    </dependencies>

    <!--添加插件-->
    <!--添加插件 有main方法時 須要添加插件-->
    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <configuration>
                    <excludes>
                        <exclude>
                            <groupId>org.projectlombok</groupId>
                            <artifactId>lombok</artifactId>
                        </exclude>
                    </excludes>
                </configuration>
            </plugin>
        </plugins>
    </build>

</project>

2.3 導入配置文件

在這裏插入圖片描述

2.4 編輯啓動配置項

在這裏插入圖片描述

2.5 頁面效果展示

在這裏插入圖片描述

2.6 關於主啓動中註解說明

說明: 該啓動項中的配置 表示 springboot啓動時,不會加載數據源相關的配置.
緣由: springBoot容器中有開箱即用的規則.可是前端項目不須要使用數據源.因此經過以下的配置,能夠正常的啓動項目
在這裏插入圖片描述前端

3.添加nginx配置

3.1 配置要求

用戶經過http://www.jt.com 的方式訪問http://localhost:8092服務器.nginx

3.2 編輯Hosts文件

在這裏插入圖片描述

3.3 編輯Nginx配置文件

# 配置京淘前臺服務器
    server {
        listen 80;
        server_name www.jt.com;

        location / {
            proxy_pass http://localhost:8092;
        }
    }

3.4 效果展示

在這裏插入圖片描述

3.5 關於谷歌瀏覽器Https協議報錯說明

1).關於Http/https之間的關係
在這裏插入圖片描述web

2).解決策略spring

1.瀏覽器中鍵入: chrome://net-internals/#hsts:
在這裏插入圖片描述chrome

1.預習什麼是跨域
2.什麼是同源策略
3.什麼是JSONP
4.什麼是CORSapache

相關文章
相關標籤/搜索