基于springboot vue移动端电影购票系统源码

开发工具:idea (eclipse) 环境:jdk1.8 mysql5.7

server:
  port: 9090

spring:
  datasource:
    driver-class-name: com.mysql.cj.jdbc.Driver
    username: root
    password: root
    type: com.alibaba.druid.pool.DruidDataSource
    url: jdbc:mysql://localhost:3306/film?useUnicode=true&characterEncoding=utf8&serverTimezone=UTC

  servlet:
    multipart:
      max-file-size: 10MB
      max-request-size: 10MB

mybatis-plus:
  mapper-locations: classpath:/mapper/**.xml

图片路径配置:

package com.film.config;

import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.CorsRegistry;
import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer;

/**
 * @author Sora
 * @date 2021/11/22 17:16
 */
@Configuration
public class WebConfig implements WebMvcConfigurer {

    @Override
    public void addCorsMappings(CorsRegistry registry) {
        registry.addMapping("/**")
                .allowedOrigins("*")
                .allowCredentials(true)
                .allowedMethods("*")
                .maxAge(3600)
                .allowedHeaders("*");
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/poster/**")
                .addResourceLocations("file:///G:/study/film_system/film/poster/");
        registry.addResourceHandler("/img/**")
                .addResourceLocations("file:///G:/study/film_system/film/img/");
    }
}
经验分享 程序员 微信小程序 职场和发展