翔仔哥,项目springboot项目部署到服务器上你有个地方可能没考虑到,因为你的是mac系统,我的系统是win系统,我部署到Linux服务器上后图片加载不出来,想着应该是server.xml中的docbase配置问题,所以MvcConfiguration.java这边替代docbase路径的配置为了部署到linux服务器上还要加一条
String os = System.getProperty(“os.name”);
if(os.toLowerCase().startsWith(“win”)) {
registry.addResourceHandler("/upload/").addResourceLocations(“file:D:/JAVA EE/mook/image/upload/”);
}else {
registry.addResourceHandler("/upload/").addResourceLocations(“file:/home/o2o/image/upload/”);
}
这样就能通用了
SSM商铺V1.0,解决毕设痛点;SpringBoot商铺V2.0,满足工作刚需
了解课程