关于springsecurity 的视图解析器(InternalResourceViewResolver)的三种配置方式

1. springsecurity.xml配置

<beans:bean class=”org.springframework.web.servlet.view.InternalResourceViewResolver”>

<beans:property name=”prefix” value=”/WEB-INF/JSP/”/>

<beans:property name=”suffix” value=”.JSP”/>

</beans:bean>

2.继承WebMvcConfigureAdapter 的java类配置

@Bean

public InternalResourceViewResolver internalresource()

{

InternalResourceViewResolver internalresource1 =new InternalResourceViewResolver();

internalresource1.setPrefix(“/WEB-INF/JSP/”);

internalresource1.setSuffix(“.jsp”);

return internalresource1;

}

3.在application.properties/或者在application.yml 配置

spring.mvc.view.prefix=/WEB-INF/JSP/

spring.mvc.view.suffix=.jsp

    原文作者:爱哭
    原文地址: https://blog.csdn.net/u010214773/article/details/79580323
    本文转自网络文章,转载此文章仅为分享知识,如有侵权,请联系博主进行删除。
点赞