IntelliJ - 用于ES6配置的弹簧引导资源

时间:2015-03-10 17:02:32

标签: angularjs intellij-idea spring-boot ecmascript-6

我试图使用带有Traceur编译器的ES6和Spring Boot作为我的后端,使用AngularJs制作一些简单的项目。我已经设法配置我的项目,所以它按预期工作。我在配置IntelliJ以正确查看资源时遇到一些问题。

我将我的静态资源放在src / main / resources / public中并配置ResourceHandlerRegistry,以便将任何未知请求重定向到主角度应用程序文件(我想使用html5位置模式,所以这是必要的。我找到了工作配置在这个问题的第二个答案中Spring Boot with AngularJS html5Mode)。

导入任何ES6模块时发生错误:

import {appModule as app} from 'resources/app/main.js'; // <- here IntelliJ sees an error, it cannot find such file, but when I run the application it all works as expected

我上传了整个项目:http://www.filedropper.com/spring-boot-test

有人能告诉我怎么做才能摆脱IntelliJ中的这个错误或检查我的项目做错了什么?

顺便说一句。我使用IntelliJ 14。

编辑: 我在StaticResourceConfigurator中有错误。它应该是:

/* ... */
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    registry.addResourceHandler("/resources/**").addResourceLocations("classpath:/public/");

而不是:

/* ... */
@Override
public void addResourceHandlers(ResourceHandlerRegistry registry) {
    registry
            .addResourceHandler("/public/**").addResourceLocations("classpath:/resources/");

但它并没有解决我的问题。

0 个答案:

没有答案
相关问题