У меня есть приложение, которое использует Spring cloud config (--spring.profiles.active = native), а также обслуживает некоторые html-страницы в одном приложении. Все нормально, пока я не вводю статические ресурсы (src/main/resources/css/bootstrap-switch.css). URL вызовов http://localhost:8080/css/bootstrap-switch.css не может с этим Exception:Spring Cloud Config и статический контент
{"timestamp":1438114326940,"status":406,"error":"Not Acceptable","exception":"org.springframework.web.HttpMediaTypeNotAcceptableException","message":"Could not find acceptable representation","path":"/css/bootstrap-switch.css"}
Когда я отключить @EnableConfigServer, то URL возвращает содержимое CSS. Я нахожусь в Spring Cloud Config версии 1.0.2.
Вот мой минималистский код, который может воспроизвести этот вопрос:
@SpringBootApplication
@EnableConfigServer
public class Application {
public static void main(String args[]) {
SpringApplication.run(ApplicationConfiguration.class, args);
}
}
@Configuration
@SpringBootApplication
class ApplicationConfiguration {
@Bean
public TestController testController() {
return new TestController();
}
@Bean
public MvcController mvcController() {
return new MvcController();
}
}
@RestController
class TestController {
@RequestMapping("/test")
@ResponseBody
public String test() {
return "hello world";
}
}
@Controller
class MvcController {
@RequestMapping("/landing")
public String landingPage() {
return "landing";
}
}
Спасибо, что сработало. –