title: Spring 4 resource properties file
body: <p><strong>MyClass</strong></p>
  
  <pre><code>@Entity
  @Table(name = "PIL_P_APPLCTN")
  public class PIL_P_APPLCTN extends META_INF {
  
      @NotBlank
      @Column(unique = true, nullable = false, name = "APPLCTN_CD")
      private String APPLCTN_CD;
  
      @NotBlank
      @Column(nullable = false, name = "APPLCTN_ID")
      private String APPLCTN_ID;
  
      @NotBlank
      @Column(nullable = false, name = "APPLCTN_DS")
      private String APPLCTN_DS;
  
      @NotNull
      @Digits(integer = 20, fraction = 0)
      @Column(nullable = false, name = "DECLG_IDNTFNT_NU")
      private BigDecimal DECLG_IDNTFNT_NU;
  
  }
  </code></pre>
  
  <p><strong>messages.properties</strong> in <strong>src/main/resources</strong></p>
  
  <pre><code>NotBlank.pil_p_applctn.APPLCTN_CD=Champ obligatoire !
  NotBlank.pil_p_applctn.APPLCTN_ID=Champ obligatoire !
  NotNull.pil_p_applctn.APPLCTN_DS=Champ obligatoire !
  NotBlank.pil_p_applctn.DECLG_IDNTFNT_NU=Champ obligatoire !
  Digits.pil_p_applctn.DECLG_IDNTFNT_NU=Seules les données numériques sont acceptées avec max 20 chiffres !
  non.unique.APPLCTN_CD={0} existe déjà !
  typeMismatch=Format invalide !
  </code></pre>
  
  <p><strong>AppConfig.class</strong></p>
  
  <pre><code>@Configuration
  @EnableWebMvc
  @ComponentScan(basePackages = "com.fussa.fyby")
  public class AppConfig extends WebMvcConfigurerAdapter {
  
  
  
      @Bean
      public ViewResolver viewResolver() {
          InternalResourceViewResolver viewResolver = new InternalResourceViewResolver();
          viewResolver.setViewClass(JstlView.class);
          viewResolver.setPrefix("/WEB-INF/views/");
          viewResolver.setSuffix(".jsp");
          return viewResolver;
      }
  @Bean
      public MessageSource messageSource() {
          ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
          messageSource.setBasename("messages");
          return messageSource;
      }
  @Override
      public void addResourceHandlers(ResourceHandlerRegistry registry) {
          registry.addResourceHandler("/resources/**").addResourceLocations("/resources/");
      }
  
  }
  </code></pre>
  
  <p>when i tried </p>
  
  <pre><code>messageSource.setBasename("classpath:/messages");
  </code></pre>
  
  <p>or</p>
  
  <pre><code>messageSource.setBasename("classpath:messages");
  </code></pre>
  
  <p>this msg is diplay in console:</p>
  
  <blockquote>
    <p>WARN : org.springframework.context.support.ResourceBundleMessageSource
    - ResourceBundle [classpath:/messages] not found for MessageSource: Can't find bundle for base  name classpath:/messages, locale fr_FR</p>
  </blockquote>
  
  <p>so i think that <code>messageSource.setBasename("messages");</code> access to <strong>messages.properties</strong>.. but why on my jsp file the default messages are shown and not the ones in <strong>messages.properties</strong> !</p>
  
  <p>Thanks for any advices..</p>