プライベートな連絡先の最初の情報
送料メール:
2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
最初のステップは、springboot で thymeleaf テンプレート エンジンを使用することです。
- <!-- thymeleaf 模板 -->
- <dependency>
- <groupId>org.springframework.boot</groupId>
- <artifactId>spring-boot-starter-thymeleaf</artifactId>
- </dependency>
- spring:
- # 模板引擎
- thymeleaf:
- mode: HTML5
- encoding: utf-8
- # 禁用缓存
- cache: false
構成で静的ファイルへのアクセスを有効にする
- public class ResourceConfig implements WebMvcConfigurer {
- @Override
- public void addResourceHandlers(ResourceHandlerRegistry registry) {
- registry.addResourceHandler("/**").addResourceLocations("classpath:/static/");
- }
- }
npm run build
パッケージ化された静的ファイルを静的フォルダーに配置し、index.html をテンプレートフォルダーに配置します。
Index.html ページにジャンプさせます
- @Controller
- @CrossOrigin
- public class IndexController {
- @GetMapping("/")
- public String index(){
- return "index";
- }
- }
港に入ってアクセスしてみよう!