首页 > 其他分享 >不使用docker部署项目需要启动的一些服务-cnblog

不使用docker部署项目需要启动的一些服务-cnblog

时间:2023-02-04 16:34:44浏览次数:61  
标签:redis 部署 config request token docker true cnblog 加载

  • mysql
  • redis
    • ./redis-serve
  • nginx:
    • ./nginx
  • 源springboot项目:
    • nohup java -jar helloworld-1.0-SNAPSHOT.jar &> hello.log &

springboot项目部署到服务器的注意点

  • application.yml

    • redis配置
    • 记得改为localhost
    server:
      port: 18081
    
    spring:
      application:
        name: com.lingxin.LingxinApplication
      datasource:
        type: com.alibaba.druid.pool.DruidDataSource
        driver-class-name: com.mysql.cj.jdbc.Driver
        url: jdbc:mysql:///studentsystem?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf-8&zeroDateTimeBehavior=convertToNull&useSSL=false&allowPublicKeyRetrieval=true
        username: root
        password: root
      redis:
        port: 6379
        host: localhost
        database: 0
      cache:
        redis:
          time-to-live: 180000
      main:
        allow-bean-definition-overriding: true
    
    mybatis-plus:
      global-config:
        db-config:
          id-type: assign_id
    
        banner: off
      configuration:
        #将下划线去掉,使用驼峰命名法
        map-underscore-to-camel-case: true
        log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
    
    lingxin:
      oss:
        accessKey: LTAI5tQvuDd3Etto8Cm7Fcuc
        secret: PW9PYcA9mQnJAbKY7EwI3X6MaL1kY5
        endpoint: oss-cn-shanghai.aliyuncs.com
        bucketName: lingxin-tanhua
        url: https://lingxin-tanhua.oss-cn-shanghai.aliyuncs.com
    

前端vue项目

// 导入axios
import axios from 'axios'

// 导入element的加载组件
import { Loading } from 'element-ui'

// 封装一个具有请求根地址的request
const request = axios.create({
  // json假数据
  baseURL: 'http://www.lingxin1123.work:18081/'
})

// request.defaults.withCredentials = true

// 定义一个加载实例
let loadingInstance = null

// 请求拦截器
request.interceptors.request.use((config) => {
  // 配置token字段
  const token = sessionStorage.getItem('token')
  if (token) {
    config.headers.Authorization = token
  }

  console.log(config)
  // 加载效果
  loadingInstance = Loading.service({ fullscreen: true })
  // 在发起请求时加载element-ui的加载效果
  return config
})

// 响应拦截器
request.interceptors.response.use(
  (response) => {
    // 关闭loading加载效果
    loadingInstance.close()
    return response
  },
  (error) => {
    // 另外的错误
    loadingInstance.close()
    return error.response
  }
)

// 导出request

export default request

标签:redis,部署,config,request,token,docker,true,cnblog,加载
From: https://www.cnblogs.com/lingxin1123/p/17091839.html

相关文章

  • SSM复习-cnblog
    依赖注入,注入配置文件中的属性名1.2加载properties文件上节中我们已经完成两个数据源druid和C3P0的配置,但是其中包含了一些问题,我们来分析下:这两个数据源中都使用到......
  • idea配置-cnblog
    另起一行快捷键shift+enter--------->ctrl+enter设置字号17,行距1.2,字体Consolas自动导包创建一个类自动生成注释信息......
  • 服务器部署项目-cnblog
    2.项目部署之前我们讲解Linux操作系统时,就提到,我们服务端开发工程师学习Linux系统的目的就是将来我们开发的项目绝大部分情况下都需要部署在Linux系统中。那么在本章节,我......
  • 订单处理-cnblog
    4.5代码开发在OrderController中创建submit方法,处理用户下单的逻辑:/***用户下单*@paramorders*@return*/@PostMapping("/submit")publicR<String>subm......
  • springboot读取docker容器系统环境变量,在alpine和debian版本的差异
    执行dockerrun--rm-e"a.a=c"-e"cc=ccs"-italpine:3.16sh,进入容器后,执行env,查看到的环境变量有cc,a.a执行dockerrun--rm-e"a.a=c"-e"cc=ccs"-itdebian......
  • Docker第二章:Docker镜像、容器卷、单机tomcat、mysql、redis安装
    镜像一种轻量级、可执行的独立软件包,我们把应用程序和配置依赖打包形成一个可交付的运行环境(包括代码、运行时所需的库、环境变量和配置文件等),这个打包好的运行环境就是im......
  • vue计算属性的完整写法-cnblog
    简单写法,给计算属性赋值报错解决方案:提供set方法实例(全选-->反选,反选->全选)<template><div><span>全选:</span><!--4.v-model关联全选-选中状态......
  • vue作用域插槽-cnblog
    使用场景:父组件需要使用到子组件的data时例子父组件有list数组,传递给子组件,子组件将数组中的属性全部显示出来,但是用什么标签显示这些属性不确定(使用插槽)父组件传......
  • vue侦听器深度侦听-cnblog
    简单类型不需要加上引号如对象user.name(注意加上引号)watch:{ "obj.name":{ ...}}侦听器的应用(存入本地存储localStorage)也可以在组件销毁时存入本......
  • async和await-cnblog
    在之前对promise对象的处理使用Promise原型函数then,catch解决回调地狱的问题,但存在冗余代码.then().then().then()asyncawaites8(esma2017)引入awaitPromis......