Skip to content

Commit

Permalink
Add search=CURRENT to MessageSourceAutoConfiguration
Browse files Browse the repository at this point in the history
  • Loading branch information
dsyer committed Aug 21, 2015
1 parent 089cda7 commit 68b55ad
Showing 1 changed file with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,11 @@

package org.springframework.boot.autoconfigure;

import static org.springframework.util.StringUtils.commaDelimitedListToStringArray;
import static org.springframework.util.StringUtils.trimAllWhitespace;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.autoconfigure.condition.SearchStrategy;
import org.springframework.boot.bind.RelaxedPropertyResolver;
import org.springframework.context.EnvironmentAware;
import org.springframework.context.MessageSource;
Expand All @@ -28,16 +32,13 @@
import org.springframework.core.env.Environment;
import org.springframework.util.StringUtils;

import static org.springframework.util.StringUtils.commaDelimitedListToStringArray;
import static org.springframework.util.StringUtils.trimAllWhitespace;

/**
* {@link EnableAutoConfiguration Auto-configuration} for {@link MessageSource}.
*
*
* @author Dave Syer
*/
@Configuration
@ConditionalOnMissingBean(MessageSource.class)
@ConditionalOnMissingBean(value=MessageSource.class, search=SearchStrategy.CURRENT)
@Order(Ordered.HIGHEST_PRECEDENCE)
public class MessageSourceAutoConfiguration implements EnvironmentAware {

Expand All @@ -54,7 +55,7 @@ public MessageSource messageSource() {
String basename = this.environment.getProperty("basename", "messages");
if (StringUtils.hasText(basename)) {
messageSource
.setBasenames(commaDelimitedListToStringArray(trimAllWhitespace(basename)));
.setBasenames(commaDelimitedListToStringArray(trimAllWhitespace(basename)));
}
String encoding = this.environment.getProperty("encoding", "utf-8");
messageSource.setDefaultEncoding(encoding);
Expand Down

0 comments on commit 68b55ad

Please sign in to comment.