После миграции Spring-Boot с 1.5.3.RELEASE
на 2.2.2.RELEASE
Thymeleaf перестал работать.
pom. xml
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.2.2.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
...
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
</dependency>
Я следовал Thymeleaf 3 руководство по миграции + чтение выпуск Spring-Boot , но безуспешно ...
Фрагмент шаблона (Thymeleaf 3.0 layout:decorate
)
<!DOCTYPE html>
<html th:lang="${#locale}" xmlns="http://www.w3.org/1999/xhtml"
xmlns:th="https://www.thymeleaf.org"
xmlns:sec="https://www.thymeleaf.org/thymeleaf-extras-springsecurity4"
xmlns:layout="https://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="layout">
<head>
<title></title>
</head>
<body>
<div layout:fragment="content">
http://localhost/index
Сравнение путей:
Фрагмент кода (1.5.3.RELEASE)
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<title>APLLICATION</title>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<!--[if IE]><meta http-equiv='X-UA-Compatible' content='IE=edge,chrome=1'/><![endif]-->
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1" />
<meta name="description" content="Application description" />
<meta name="fragment" content="text" />
<link rel="stylesheet" href="css/vendor/bootstrap.min.css" />
<link rel="stylesheet" href="css/vendor/jquery-ui.min.css" />
...
Фрагмент кода (2.2.2.RELEASE)
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml"
xmlns:layout="https://www.ultraq.net.nz/thymeleaf/layout"
layout:decorate="layout">
<head>
<title></title>
</head>
<body>
<div layout:fragment="content">
...
Любая помощь приветствуется. Спасибо
РЕДАКТИРОВАТЬ:
@ Marged, модели установлены:
@Configuration
public class MvcConfig implements WebMvcConfigurer {
@Override
public void addViewControllers(ViewControllerRegistry registry) {
registry.addViewController("/index").setViewName("index");
...
}
}
Контекст-путь по умолчанию (/
)
@SpringBootApplication(exclude = { MongoAutoConfiguration.class, MongoDataAutoConfiguration.class })
@EnableConfigurationProperties({ AppConfig.class })
@EnableScheduling
@EnableJpaRepositories
@EnableAutoConfiguration
@ComponentScan("foo.bar")
public class MainApplication {
public static void main(String[] args) {
SpringApplication.run(MainApplication.class, args);
}
}