プロパティの読み取り

プロパティファイル作成

src配下(Mavenの場合src.main.resources配下)でapp.propertiesファイル作成する。
文字化け防止のため、EclipseのLimyプロパティエディターで編集する。
記入例:list.max=1000

Java Configより定義

...
@PropertySource("classpath:app.properties")
public class WebMvcConfig extends WebMvcConfigurerAdapter {
    ...
    @Bean
    static PropertySourcesPlaceholderConfigurer placeholderConfigurer() {
        return new PropertySourcesPlaceholderConfigurer();
    }
}

xmlより定義

<context:property-placeholder location="classpath:application.properties"/>

プロパティの使用

@Value("${list.max}")
private int maxList;