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
import org.springframework.context.annotation.Configuration; | |
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | |
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; | |
import lombok.RequiredArgsConstructor; | |
@RequiredArgsConstructor | |
@Configuration | |
public class BaseApplicationConfig implements WebMvcConfigurer { |
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
import javax.servlet.ServletContext; | |
import org.springframework.context.annotation.Bean; | |
import org.springframework.context.annotation.Configuration; | |
import org.springframework.web.context.ServletContextAware; | |
import org.springframework.web.servlet.LocaleResolver; | |
import org.springframework.web.servlet.config.annotation.InterceptorRegistry; | |
import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; | |
import org.springframework.web.servlet.i18n.CookieLocaleResolver; | |
import org.springframework.web.servlet.i18n.LocaleChangeInterceptor; |
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
import static org.hamcrest.MatcherAssert.assertThat; | |
import static org.hamcrest.Matchers.*; | |
import java.util.HashMap; | |
import java.util.Map; | |
import java.util.Set; | |
import java.util.stream.Stream; | |
import org.junit.Test; |
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
// java.util.List の初期化を一行で書く | |
List<String> list = new ArrayList<String>() {{add("a"); add("b"); add("c");}}; | |
// 変更不可能な List で良い場合は | |
List list = Arrays.asList("a", "b", "c"); | |
// Arrays.asList をジェネリックスを使って書くと | |
List<Integer> list = Arrays.<Integer>asList(1, 2, 3); | |
// asList を使いつつ、追加可能な List を作るには、冗長だが以下のようにする | |
List<Integer> list = new ArrayList<Integer>(Arrays.<Integer>asList(1, 2, 3)); |