mangusbrother
mangusbrother

Reputation: 4156

Groovy spring boot project with javascript

I am following this guide's structure.

I have added a script.js file (currently placed in the templates directory). This script.js is referenced from one of my html files, however when i start my application the script.js is not being found successfully.

From what i'm seeing i think you need to @Grab it somehow? Not sure.

How can i make it that my script.js file is discoverable?


Edit:

Here is a quicker view of my structure

greeting.html contains <script src="script.js" /> however it is not being loaded

Upvotes: 0

Views: 154

Answers (1)

Dave Syer
Dave Syer

Reputation: 58094

Per the user guide: if the resource is static you could try putting static content in one of the standard locations (e.g. classpath:static/ or classpath:public/).

If you need it to be a template (not sure thymeleaf can handle that easily) then you would have to change the view resolver configuration, but my guess is that's not the problem.

Upvotes: 2

Related Questions