|
24 | 24 | import java.util.Properties; |
25 | 25 | import java.util.stream.Collectors; |
26 | 26 |
|
| 27 | +import org.slf4j.Logger; |
| 28 | +import org.slf4j.LoggerFactory; |
27 | 29 | import org.springframework.beans.factory.ObjectProvider; |
28 | 30 | import org.springframework.beans.factory.annotation.Autowired; |
29 | 31 | import org.springframework.beans.factory.config.PropertiesFactoryBean; |
|
65 | 67 | @EnablePluginRegistries({ LinkDiscoverer.class }) |
66 | 68 | public class HateoasConfiguration { |
67 | 69 |
|
| 70 | + private static final Logger LOGGER = LoggerFactory.getLogger(HateoasConfiguration.class); |
| 71 | + |
68 | 72 | static String I18N_BASE_NAME = "rest-messages"; |
69 | 73 | static String I18N_DEFAULTS_BASE_NAME = "rest-default-messages"; |
70 | 74 |
|
71 | 75 | private @Autowired ApplicationContext context; |
72 | 76 |
|
73 | 77 | @Bean |
74 | 78 | public MessageResolver messageResolver() { |
75 | | - return MessageResolver.of(lookupMessageSource()); |
| 79 | + |
| 80 | + var lookupMessageSource = lookupMessageSource(); |
| 81 | + |
| 82 | + LOGGER.error("MessageSource {}", lookupMessageSource); |
| 83 | + |
| 84 | + return MessageResolver.of(lookupMessageSource); |
76 | 85 | } |
77 | 86 |
|
78 | 87 | @Bean |
@@ -140,6 +149,8 @@ private final AbstractMessageSource lookupMessageSource() { |
140 | 149 | return null; |
141 | 150 | } |
142 | 151 |
|
| 152 | + LOGGER.error("Candidates: {}", candidates); |
| 153 | + |
143 | 154 | ReloadableResourceBundleMessageSource messageSource = new ReloadableResourceBundleMessageSource(); |
144 | 155 | messageSource.setResourceLoader(context); |
145 | 156 | messageSource.setBasename("classpath:".concat(I18N_BASE_NAME)); |
@@ -170,9 +181,13 @@ private final Properties loadProperties(List<Resource> sources) { |
170 | 181 |
|
171 | 182 | private final List<Resource> loadResourceBundleResources(String baseName, boolean withWildcard) { |
172 | 183 |
|
| 184 | + var location = String.format("classpath:%s%s.properties", baseName, withWildcard ? "*" : ""); |
| 185 | + |
| 186 | + LOGGER.error("Trying to resolve: {}", location); |
| 187 | + |
173 | 188 | try { |
174 | 189 | return Arrays // |
175 | | - .stream(context.getResources(String.format("classpath:%s%s.properties", baseName, withWildcard ? "*" : ""))) // |
| 190 | + .stream(context.getResources(location)) // |
176 | 191 | .filter(Resource::exists) // |
177 | 192 | .collect(Collectors.toList()); |
178 | 193 |
|
|
0 commit comments