Springboot not serving css content from html file -
good day, stack.
i've been stuck on issue while, there lot of duplicates mine differs in code , hierarchy looks similar others, refuses work. i'll jump right in , show code.
the app
@springbootapplication public class bookstoreapplication { public static void main(string[] args) { springapplication.run(bookstoreapplication.class, args); } }
the controller
@controller public class homecontroller { @requestmapping("/") public modelandview showhome() { system.out.println("showing home page"); return new modelandview("test"); } }
the config
@configuration @enablewebmvc @componentscan("com.sean.books") public class webconfig extends webmvcconfigureradapter { @bean public viewresolver getviewresolver() { system.out.println("settings view resolver"); internalresourceviewresolver resolver = new internalresourceviewresolver(); resolver.setprefix("/web-inf/html/"); resolver.setsuffix(".html"); return resolver; } @override public void configuredefaultservlethandling( defaultservlethandlerconfigurer configurer) { system.out.println("configuring servlet handling"); configurer.enable(); } }
the html
<!doctype html> <html lang="en" ng-app> <head> <meta charset="utf-8"> <title>welcome bookart</title> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css"/> <link rel="stylesheet" href="css/app.css"> <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.2.26/angular.min.js"></script> </head> <body> <div id="header-wrapper"> <span class="logo pull-left">book cart</span> <span class="tagline pull-left">we have 1 million books</span> <div class="nav-wrapper pull-left"> <ul class="nav nav-pills"> <li class="active"><a href="#">books</a></li> <li><a href="#">kart</a></li> </ul> </div> </div> </body> </html>
the folder structure
everything seems correct, i've tried access css file in several different ways seem unable css show.
some advice appreciated.
the solution move css folder under /web-inf/ /web-inf/css, reason having files under static won't deploy. i'll leave now.
Comments
Post a Comment