前端修改:
1.修改前端路由src/router/index.js
修改前:mode: 'history',
修改后:mode: 'hash',
2.修改打包部署根路径.env.production
修改前:VUE_APP_BASE_API = '/prod-api'
修改后:VUE_APP_BASE_API = '/'
后端修改:
1.修改admin模块里面的com/web/controller/system/SysIndexController.java
修改前:
@RestController
@RequestMapping("/")
return StringUtils.format("欢迎使用{}后台管理框架,当前版本:v{},请通过前端地址访问。", ProjectConfig.getName(), ProjectConfig.getVersion());
修改后:
@Controller
@RequestMapping(value = {"/", "/index"})
return "redirect:/index.html";
2.修改framework模块里面的com/framework/config/SecurityConfig.java
修改前:
.antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
修改后:
.antMatchers(HttpMethod.GET, "/","/index", "/*.html", "/**/*.html", "/**/*.ico", "/**/*.css", "/**/*.js", "/profile/**").permitAll()
.antMatchers(HttpMethod.GET,"/static/**").permitAll()
.antMatchers("/swagger-ui.html", "/swagger-resources/**", "/webjars/**", "/*/api-docs", "/druid/**").permitAll()
3.配置添加<plugin>到admin模块中的pom.xml里面的<build><plugins>节点下面,保证打包的时候复制dist里面的内容到resources中的static里面
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>3.2.0</version>
<executions>
<execution>
<id>copy-frontend-resources</id>
<phase>process-resources</phase>
<goals>
<goal>copy-resources</goal>
</goals>
<configuration>
<outputDirectory>${project.build.outputDirectory}/static</outputDirectory>
<resources>
<resource>
<directory>${project.basedir}/../vue/dist</directory>
<filtering>false</filtering>
</resource>
</resources>
</configuration>
</execution>
</executions>
</plugin>
若依前后端打包成jar运行
于 2025-09-26 10:00:30 首次发布
1万+





