代码之家  ›  专栏  ›  技术社区  ›  Hamza Rouijel

Spring WebFlux thymelaf错误:无法解析名称为“index”的视图

  •  0
  • Hamza Rouijel  · 技术社区  · 1 年前

    你好,我使用Spring WebFlux,我试图将thymelaf集成到我的项目中,但我遇到了这个错误: enter image description here

    这是我的控制器: enter image description here

    这是我的申请。yaml:

    spring:
      application:
        name: fbpayapi
      thymeleaf:
        prefix: classpath:/templates/
        suffix: .html
      main:
        web-application-type: reactive
      webflux:
        base-path: /api-mgr
      web:
        resources:
          add-mappings: false
    

    这是我的依赖:

    <dependency>
                    <groupId>org.thymeleaf.extras</groupId>
                    <artifactId>thymeleaf-extras-springsecurity5</artifactId>
                    <version>3.0.4.RELEASE</version>
                </dependency>
                <dependency>
                    <groupId>org.springframework.boot</groupId>
                    <artifactId>spring-boot-starter-thymeleaf</artifactId>
                </dependency>
    

    这是src/main/resources/index.html中的index.html:

    <!DOCTYPE html>
    <html lang="en">
    <head>
        <meta charset="UTF-8">
        <title>Title</title>
    </head>
    <body>
    
    </body>
    </html>
    

    我尝试了@RestController,但也不起作用

    0 回复  |  直到 1 年前