若依打包将vue放到.jar里面部署

发布时间:2023年12月18日

1.vue静态文件,以及单页面

ruoyi-admin\src\main\resources\static?

\ruoyi-admin\src\main\resources\templates

2.后台开放白名单

"/cms",
"/cms#/login"

3. mvc访问vue页面入口,接口

package com.ruoyi.web.controller.system;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

/***
 * 首页vue配置
 */
@Controller
public class SysIndexController {

    /***
     * 访问门户首页,测试
     * @return
     */
    @RequestMapping(value = "/cms",method = RequestMethod.GET)
    public String index()
    {
        return "index";
    }


    /***
     * 访问后台管理系统登录界面,测试
     * @return
     */
    @RequestMapping(value = "/admincms",method = RequestMethod.GET)
    public String admincms()
    {
        return "index";
    }


}

4.

#vue静态资源读取
mvc:
  view:
    prefix: .html
  static-path-pattern: /**
resources:
  static-locations: classpath:/templates/,classpath:/static/

5.maven依赖

    <!--解决Handler dispatch failed;nested exception is java.lang.NoClassDefFoundError: javax/xml/bind/DatatypeConverter-->
        <dependency>
            <groupId>javax.xml.bind</groupId>
            <artifactId>jaxb-api</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-impl</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>com.sun.xml.bind</groupId>
            <artifactId>jaxb-core</artifactId>
            <version>2.3.0</version>
        </dependency>
        <dependency>
            <groupId>javax.activation</groupId>
            <artifactId>activation</artifactId>
            <version>1.1.1</version>
        </dependency>

文章来源:https://blog.csdn.net/weixin_41037490/article/details/134994300
本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。