springboot themaleaf 初めてページに入るときに css が読み込まれない
最近、springboot themaleaf プロジェクトに取り組んでいるときに、ホームページの CSS スタイルが読み込まれないという状況に遭遇しました。インターセプターの登録時に CSS スタイルが追加されていないことがわかりました。以下は最新のスタート コードです
public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor( new LoginHandleInterceptor()).addPathPatterns("/**") .excludePathPatterns("/index.html", // 排除掉首页请求 "/", // 排除掉首页请求 ) ; //registry.addInterceptor(new HandlerInterceptor()). }
初めてログイン ページにアクセスすると、対応する js CSS がインターセプターによってインターセプトされ、は読み込まれていません。対応する CSS、jquery などをインターセプターに入れるだけです
public void addInterceptors(InterceptorRegistry registry) { registry.addInterceptor( new LoginHandleInterceptor()).addPathPatterns("/**") .excludePathPatterns("/index.html", // 排除掉首页请求 "/", // 排除掉首页请求 "/user/login", "/asserts/css/*.css", "/asserts/img/*.svg", "/asserts/js/*.js", "/webjars/bootstrap/4.1.1/css/*.css", "/mancenter/*", "/error", "/asserts/lib/jquery/*","/asserts/lib/*.js") ; //registry.addInterceptor(new HandlerInterceptor()). }
springboot themaleaf さまざまなエラー報告の問題
1. themaleaf ページにアクセスして、エラーを報告してください。 error
ホワイトラベル エラー ページ
このアプリケーションには /error の明示的なマッピングがないため、これがフォールバックとして表示されます。Mon Jun 24 11:08 :43 CST 2019
予期しないエラーが発生しました (type=Not Found、status=404)。
利用可能なメッセージはありません
エラー 1:
WebMvcConfig クラスはデバッグ中に追加されました
package com.feilong.Reptile.config; import org.springframework.stereotype.Component; import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; /** * 配置静态资源映射 * * @author sunziwen * @version 1.0 * @date 2018-11-16 14:57 **/ @Component public class WebMvcConfig implements WebMvcConfigurer { /** * 添加静态资源文件,外部可以直接访问地址 * * @param registry */ @Override public void addResourceHandlers(ResourceHandlerRegistry registry) { registry.addResourceHandler("/static/**").addResourceLocations("classpath:/static/"); } }
このクラスを削除した後もエラーが報告されます。パッケージ パスの問題である可能性があると推測されます。新しいプロジェクトを再作成し、古いプロジェクトを転送してください。さらに多くのエラーが報告されます。
以上がSpringbootのmeleafが初めてページに入るときにCSSを読み込まない問題を解決する方法の詳細内容です。詳細については、PHP 中国語 Web サイトの他の関連記事を参照してください。

jvm'sperformanceiscompetitivewitherruntimes、sped、safety、andproductivityの提供

javaachievesplatformedentenceTheThejavavirtualMachine(JVM)、avainwithcodetorunonanyplatformwithajvm.1)codescompiledintobytecode、notmachine-specificcode.2)

thejvmisanabstractcomputingMachineCrucialForrunningJavaProgramsDuetoitsPlatForm-IndopentInterChitecture.Itincludes:1)ClassLoaderForloadingClasses、2)Runtimedataareaforforforatastorage、3)executionEngineWithinterter、Jitcompiler、およびGarbagecolfecolfecolfececolfecolfer

jvmhasacloserelationshiptheosasittrantesjavabytecodecodecodecodecodecodecodecodecodecodecodecodecodetructions、manageSmemory、およびhandlesgarbagecollection.thisrelationshipallowsjavatorunonvariousosenvirnments、Butalsedentsはspeedifediferentjvmbeviorhiorsandosendisfredediferentjvmbehbehioorysando

Javaの実装「Write and、Run Everywherewhere」はBytecodeにコンパイルされ、Java仮想マシン(JVM)で実行されます。 1)Javaコードを書き、それをByteCodeにコンパイルします。 2)JVMがインストールされたプラットフォームでByteCodeが実行されます。 3)Javaネイティブインターフェイス(JNI)を使用して、プラットフォーム固有の機能を処理します。 JVMの一貫性やプラットフォーム固有のライブラリの使用などの課題にもかかわらず、Woraは開発効率と展開の柔軟性を大幅に向上させます。

javaachievesplatformentenceTheTheTheJavavirtualMachine(JVM)、CodetorunondifferentoperatingSystemswithOutModification.thejvmcompilesjavacodeplatform-IndopentedbyTecodeを承認することを許可します

javaispowerfulfulduetoitsplatformindepentence、object-orientednature、richstandardlibrary、performancecapability、andstrongsecurityfeatures.1)platformendependenceallowseplicationStorunonaydevicesupportingjava.2)オブジェクト指向のプログラマン型

上位のJava関数には、次のものが含まれます。1)オブジェクト指向プログラミング、サポートポリ型、コードの柔軟性と保守性の向上。 2)例外処理メカニズム、トライキャッチ式ブロックによるコードの堅牢性の向上。 3)ゴミ収集、メモリ管理の簡素化。 4)ジェネリック、タイプの安全性の向上。 5)コードをより簡潔で表現力豊かにするためのAMBDAの表現と機能的なプログラミング。 6)最適化されたデータ構造とアルゴリズムを提供するリッチ標準ライブラリ。


ホットAIツール

Undresser.AI Undress
リアルなヌード写真を作成する AI 搭載アプリ

AI Clothes Remover
写真から衣服を削除するオンライン AI ツール。

Undress AI Tool
脱衣画像を無料で

Clothoff.io
AI衣類リムーバー

Video Face Swap
完全無料の AI 顔交換ツールを使用して、あらゆるビデオの顔を簡単に交換できます。

人気の記事

ホットツール

SublimeText3 中国語版
中国語版、とても使いやすい

WebStorm Mac版
便利なJavaScript開発ツール

ゼンドスタジオ 13.0.1
強力な PHP 統合開発環境

SublimeText3 Linux 新バージョン
SublimeText3 Linux 最新バージョン

ドリームウィーバー CS6
ビジュアル Web 開発ツール
