Created
March 31, 2016 22:09
-
-
Save MafaldaLandeiro/57c12f4e48423601a6ab5139bdea7be7 to your computer and use it in GitHub Desktop.
Spring MVC configuration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package org.springSecurityLogin.configuration; | |
| import org.springSecurityLogin.exception.AccessDeniedExceptionHandler; | |
| import org.springframework.context.annotation.Bean; | |
| import org.springframework.context.annotation.ComponentScan; | |
| import org.springframework.context.annotation.Configuration; | |
| import org.springframework.context.annotation.Import; | |
| import org.springframework.web.servlet.config.annotation.EnableWebMvc; | |
| import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter; | |
| import org.springframework.web.servlet.view.InternalResourceViewResolver; | |
| import org.springframework.web.servlet.view.JstlView; | |
| @EnableWebMvc | |
| @Configuration | |
| @ComponentScan({ "org.springSecurityLogin.*" }) | |
| @Import({ SecurityConfiguration.class }) | |
| public class AppConfig extends WebMvcConfigurerAdapter{ | |
| @Bean | |
| public InternalResourceViewResolver viewResolver() { | |
| InternalResourceViewResolver viewResolver = new InternalResourceViewResolver(); | |
| viewResolver.setViewClass(JstlView.class); | |
| viewResolver.setPrefix("/WEB-INF/pages/"); | |
| viewResolver.setSuffix(".jsp"); | |
| return viewResolver; | |
| } | |
| @Bean | |
| public AccessDeniedExceptionHandler errorPage(){ | |
| AccessDeniedExceptionHandler errorPage = new AccessDeniedExceptionHandler("403"); | |
| return errorPage; | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment