简体   繁体   中英

Issue with starting application Spring MVC + Grunt + JHipster + AngularJS

I am using Spring MVC in my RESTful web aplication that I run using Maven . I have two profiles:

  1. Development profile, which works properly on hsql and oracle. I successfully build my application, and it works great.

  2. Production profile, where I am using Grunt Javascript Task runner, for minification Javascript, CSS and HTML files.

When I run my application in "prod" profile, Maven is building my application using Grunt . Grunt does his job properly, he change my files based on configuration in Gruntfile.js . Files are changed properly and saved in dist folder, and new index.html file is created with references to newly generated CSS and Javascript files. I build my app successfully.

The problem is, when I start my app on http://localhost:8080 , I only load css and javascript files from dist folder and make call GET login , but I am stuck here (using Firebug in Firefox browser):

在此处输入图片说明

Not one REST call is made to my application. When I start application in working dev profile, first call is for rest/authenticate , but in prod profile, I never gets there. When I turn on logs for spring framework, I can see that my AntPathRequestMatcher gets stuck after checking my favicon.ico, and never gets to rest/authenticate . It seams like my javascript code is not initialized properly so he can make REST calls?!

I think I made my configuration properly in my WebConfigrurer.java , SecurityConfiguration.java , DispatcherServletConfiguration.java ... But I can't resolve this issue.

If anyone had a similar problem, I would appreciate if he/she helps me. Thanks.

Yes, it sounds like your javascript isn't running. Any errors in the firebug console?

Obviously, the size of the script.js is 0 bytes?! Did you checked the content?

May be, it's possible that your scripts are not between (I assume you are using Jhipster v1.XX because you have script.js instead of app.js and vendor.js...)

    <!-- build:js scripts/scripts.js -->

and

     <!-- endbuild -->

?

Grunt only packages all scripts that are between these two tags

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM