问题描述:
在微服务环境下,由网关将请求转发到各个微服务,进行Oauth2登录,找不到静态文件的登录界面
目录结构如下:
请求参数返回:
解决方案:
- 查看配置文件:
spring.mvc.view.prefix = /WEB-INF/wiews/
spring.mvc.view.suffix = .jsp
-
查看pom依赖
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-tomcat</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<!--<version>1.2</version>-->
<!-- <type>jar</type>-->
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>javax.servlet.jsp-api</artifactId>
<version>${javax.servlet.jsp-api.version}</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-aop</artifactId>
</dependency>
<dependency>
<groupId>org.aspectj</groupId>
<artifactId>aspectjweaver</artifactId>
</dependency>
<!-- shiro+redis缓存插件 -->
<dependency>
<groupId>org.crazycake</groupId>
<artifactId>shiro-redis</artifactId>
<version>3.2.3</version>
</dependency>
<!--用于编译jsp -->
<dependency>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-jasper</artifactId>
</dependency>
-
查看打包静态资源
3.1 查看target内是将jsp等静态资源打包进去
3.2 如果没有jsp文件则检查pom中静态资源打包(配置如下)
<resources>
<resource>
<directory>src/main/java</directory>
<includes>
<include>**/*.xml</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/resources</directory>
<includes>
<include>**/*.*</include>
</includes>
<filtering>false</filtering>
</resource>
<resource>
<directory>src/main/webapp</directory>
<targetPath>META-INF/resources</targetPath>
<includes>
<include>**/*.*</include>
</includes>
<filtering>false</filtering>
</resource>
</resources>
-
查看打包类型是否未war包,如果jar包静态资源无法加载,改为jar包就好了
jar包和war包的区别
版权声明:本文为qq_14902731原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。