Cannot resolve controller URL on a Spring Boot Example Project

Answered

Hello, I'm evaluating IntelliJ 2018.1 at the moment, so I have put together some guides from spring.io.

As recommended, I put my CSS file under resources/static as css/styles.css

The templates are also available at resources under templates.

The home.html looks like this:

<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org">
<head>
<title>Spring Security Example</title>
<link rel="stylesheet" type="text/css" href="/css/styles.css">
</head>
<body>
<h1>Welcome!</h1>

<p>Click <a th:href="@{/hello}">here</a> to see a greeting.</p>
</body>
</html>

IntelliJ has set the resources folder as Resources Root

Nevertheless, the IDE complains:
Cannot resolve controller URL '/css/styles.css' less... (Strg+F1)
This inspection checks unresolved file references in HTML.

1
1 comment

Please file a bug at https://youtrack.jetbrains.com/issues/IDEA with this sample project attached. Thank you.

0

Please sign in to leave a comment.