Commit 537b0c3f authored by Dave Syer's avatar Dave Syer

Use enum for MessageCodesResolver format

Fixes gh-670
parent 1cbef022
......@@ -31,6 +31,7 @@ import org.springframework.beans.factory.ListableBeanFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.boot.autoconfigure.condition.ConditionalOnClass;
import org.springframework.boot.autoconfigure.condition.ConditionalOnExpression;
......@@ -137,7 +138,7 @@ public class WebMvcAutoConfiguration {
private Integer cachePeriod;
@Value("${spring.mvc.message-codes-resolver.format:}")
private String messageCodesResolverFormat = "";
private DefaultMessageCodesResolver.Format messageCodesResolverFormat = null;
@Value("${spring.mvc.locale:}")
private String locale = "";
......@@ -204,10 +205,10 @@ public class WebMvcAutoConfiguration {
@ConditionalOnExpression("'${spring.mvc.message-codes-resolver.format:}' != ''")
public MessageCodesResolver messageCodesResolver() {
DefaultMessageCodesResolver resolver = new DefaultMessageCodesResolver();
resolver.setMessageCodeFormatter(DefaultMessageCodesResolver.Format.valueOf(messageCodesResolverFormat));
resolver.setMessageCodeFormatter(this.messageCodesResolverFormat);
return resolver;
}
@Override
public void addFormatters(FormatterRegistry registry) {
for (Converter<?, ?> converter : getBeansOfType(Converter.class)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment