解决引入JS文件出现net::ERR_ABORTED

1:引入的时候一定要注意编码格式规范,要写type=“text/javascript”

不能

然后重启idea(我还没想出来为什么一定要重启)

不行的话

2:Application里继承WebMvcConfigurationSupport,重写addResourceHandlers方法

public class Application extends WebMvcConfigurationSupport {

          public static void main(String[] args) {
                SpringApplication.run(Application.class, args);
            }

        @Override
        protected void addResourceHandlers(ResourceHandlerRegistry registry) {
                //registry.addResourceHandler("/static/**").addResourceLocations(ResourceUtils.CLASSPATH_URL_PREFIX + "/static/");
                registry.addResourceHandler("/static/**").addResourceLocations(     "classpath:/static/");
                super.addResourceHandlers(registry);
            }

}

再不行的话

用前端个框架吧

你可能感兴趣的:(js,java)