com.tamnd.app.config.WebMvcConfig.java Source code

Java tutorial

Introduction

Here is the source code for com.tamnd.app.config.WebMvcConfig.java

Source

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tamnd.app.config;

import com.tamnd.app.common.Common;
import com.tamnd.app.config.security.SpringSecurityConfig;
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.ResourceHandlerRegistry;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;

/**
 *
 * @author tamnd
 */
@EnableWebMvc
@Configuration
@ComponentScan(basePackages = { "com.tamnd.app.*" })
@Import({ DataSourceConfig.class, HibernateConfig.class, SpringSecurityConfig.class })
public class WebMvcConfig extends WebMvcConfigurerAdapter {

    @Override
    public void addViewControllers(ViewControllerRegistry registry) {
        //      registry.addRedirectViewController("", Common.DEFAULT_URL);
        //      registry.addRedirectViewController("/", Common.DEFAULT_URL);
    }

    @Override
    public void addResourceHandlers(ResourceHandlerRegistry registry) {
        registry.addResourceHandler("/static/**").addResourceLocations("/ngbp/build/");
    }
}