I did upgrade from spring boot 2.6.15 to 2.7.0
More about my set up:
html thymeleaf page named myPage.html
is in directory myproject/src/main/resources/templates/html/myPage.html
<!DOCTYPE HTML>
<html>
<head>
<title>MyPage</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title></title>
<link href='https://fonts.googleapis.com/css?family=Roboto:300,400,500,700|Material+Icons' rel="stylesheet">
<link rel="icon" type="image/png" th:href="@{/img/favicon.png}" />
</head>
<body>
<div id="app"></div>
<script type="text/javascript" th:src="@{/js/app/myApp.js}" ></script>
</body>
</html>
myApp.js
is in directory myproject/src/main/resources/static/js/app/myApp.js
spring controller
package com.myapp;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
@Controller
public class ViewController {
@GetMapping("/myPage")
public String myPage() {
return "html/myPage";
}
}
Before update to spring boot 2.7.0 I was able to load this html page containing javascript in my android app and everything was working fine using this code to load
webView.getSettings().setJavaScriptEnabled(true);
webView.loadUrl("http://localhost:8080/myPage");
After update to springboot 2.7.0
I'm receiving an error:
I/chromium: [INFO:CONSOLE(0)] "Refused to execute script from 'http://localhost:8080/js/app/myApp.js' because its MIME type ('') is not executable, and strict MIME type checking is enabled.", source: http://localhost/myPage (0)
I was trying to find in release notes what was changed with MIME, Content-Type etc. but I found nothing https://github.com/spring-projects/spring-boot/wiki/Spring-Boot-2.7-Release-Notes I also have checked deprecation list from 2.5.0 https://docs.spring.io/spring-framework/docs/2.5.x/javadoc-api/deprecated-list.html but again nothing. Maybe some body of you know what could happen and how to fix that?
Comment From: bclozel
Duplicates #36283