Skip to content

Commit

Permalink
minor
Browse files Browse the repository at this point in the history
  • Loading branch information
alesaudate committed Jun 16, 2024
1 parent 378e6c0 commit 1831fb7
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 6 deletions.
3 changes: 1 addition & 2 deletions cap07/src/main/java/app/car/cap07/config/AppConfig.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,14 @@
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.support.ReloadableResourceBundleMessageSource;
import org.springframework.context.support.ResourceBundleMessageSource;

@Configuration
public class AppConfig {


@Bean
public MessageSource messageSource() {
ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource();
var messageSource = new ReloadableResourceBundleMessageSource();
messageSource.setBasename("classpath:i18n/messages");
messageSource.setDefaultEncoding("UTF-8");
return messageSource;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public ErrorResponse handleMethodArgumentNotValid(MethodArgumentNotValidExceptio
.getFieldErrors()
.stream()
.map(this::getMessage)
.collect(Collectors.toList());
.toList();

return new ErrorResponse(messages);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import org.springframework.web.servlet.i18n.AcceptHeaderLocaleResolver;

import jakarta.servlet.http.HttpServletRequest;
import java.util.Arrays;
import java.util.List;
import java.util.Locale;
import java.util.Optional;
Expand All @@ -27,6 +26,4 @@ public Locale resolveLocale(HttpServletRequest request) {
Locale locale = Locale.lookup(list, ACCEPTED_LOCALES);
return Optional.ofNullable(locale).orElse(DEFAULT_LOCALE);
}


}

0 comments on commit 1831fb7

Please sign in to comment.