关于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

猜你喜欢

转载自blog.csdn.net/u010214773/article/details/79580323