Spring Boot static resources html

I created a spring starter project, but i can't access the static resource

Path

Application

package com.example.demo;

import org.glassfish.jersey.server.ResourceConfig;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application10_4 extends ResourceConfig{

     public Application10_4(){
            register(new BookService10_4());
        }
       
        public static void main(String[] args){
            SpringApplication.run(Application10_4.class, args);
        }
}

Dependencies in pom.xml

<dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jersey</artifactId>
        </dependency>
        
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
        </dependency>
        
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
        </dependency>
    </dependencies>

test

when I use the self-generated application I can access static resources

package com.example.demo;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Demo1Application {

    public static void main(String[] args) {
        SpringApplication.run(Demo1Application.class, args);
    }

}

What is it register(new BookService10_4()); ?

Spring Boot will automatically add static web resources located within any of the following directories:

/META-INF/resources/
/resources/
/static/
/public/

So you can create a public/ directory under resources/ directory and put your static contents there. And they will be reached by: http://localhost:3000/koo.htm. (assuming the server.port is 3000)

You can customize these directories using spring.resources.static-locations in the application.properties.

You can continue read in https://spring.io/blog/2013/12/19/serving-static-web-content-with-spring-boot