620
SpringBoot
13
その他、
Spring MVC
の 設 定を細 かくカスタマイズするには 、
org.springframework.web.servlet.config.
annotation.WebMvcConfigurer
を実装したコンフィギュレーションクラスを作成し、コンポーネントスキャン
対象のパッケージに 配置します。
WebMvcConfigurerインターフェイスの使用例
package com.example.demo;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.ViewControllerRegistry;
import org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter;
@Configuration
public class WebMvcConfig implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/login").setViewName("login"); ...