66import org .springframework .boot .autoconfigure .SpringBootApplication ;
77import org .springframework .boot .web .servlet .ServletRegistrationBean ;
88import org .springframework .context .annotation .Bean ;
9- import org .springframework .web .servlet .config .annotation .EnableWebMvc ;
10- import org .springframework .web .servlet .config .annotation .ResourceHandlerRegistry ;
11- import org .springframework .web .servlet .config .annotation .ViewControllerRegistry ;
12- import org .springframework .web .servlet .config .annotation .WebMvcConfigurer ;
139
1410import java .util .HashMap ;
1511
1612@ SpringBootApplication // (scanBasePackageClasses = { LunaApplication.class, RemoteMvelConsoleController.class })
17- @ EnableWebMvc
18- public class ChartApplication implements WebMvcConfigurer {
19-
13+ // @EnableWebMvc implements WebMvcConfigurer
14+ public class ChartApplication {
2015 public static void main (String [] args ) {
2116 System .out .println (" *** main thread started *** " +Thread .currentThread ());
2217 SpringApplication .run (ChartApplication .class , args );
2318 System .err .println (" *** main thread finishes *** " +Thread .currentThread ());
2419 }
2520
26- private static final String [] CLASSPATH_RESOURCE_LOCATIONS = {
27- "classpath:/META-INF/resources/" ,// todo classpath*:
28- "classpath:/META-INF/resources/click/" ,
29- "classpath:/resources/" ,
30- "classpath:/resources/click/" ,
31- "classpath:/static/" ,
32- "classpath:/static/click/" ,
33- "classpath:/public/"
34- };
35-
36- @ Override
37- public void addResourceHandlers (ResourceHandlerRegistry registry ) {
38- registry .addResourceHandler ("/**" ).addResourceLocations (CLASSPATH_RESOURCE_LOCATIONS );
39- }
21+ // private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {
22+ // "classpath:/META-INF/resources/",// todo classpath*:
23+ // "classpath:/resources/",
24+ // "classpath:/static/",
25+ // "classpath:/public/"
26+ // };
27+ // @Override public void addResourceHandlers(ResourceHandlerRegistry registry) {
28+ // registry.addResourceHandler("/**").addResourceLocations(CLASSPATH_RESOURCE_LOCATIONS);
29+ // }
30+ //@Override public void addViewControllers(ViewControllerRegistry registry) {
31+ // registry.addViewController("/").setViewName("forward:/home.htm");
32+ //}
4033
4134 @ Bean
4235 public ServletRegistrationBean <ClickServlet > clickServlet () {
43- val reg = new ServletRegistrationBean <>(new ClickServlet (), "*.htm" , "/click/*" );
36+ val reg = new ServletRegistrationBean <>(new ClickServlet (), "*.htm" ); // , "/click/*"
4437 reg .setName ("ClickServlet" );
4538 reg .setLoadOnStartup (0 );
4639
@@ -53,10 +46,4 @@ public ServletRegistrationBean<ClickServlet> clickServlet () {
5346
5447 return reg ;
5548 }
56-
57- @ Override
58- public void addViewControllers (ViewControllerRegistry registry ) {
59- registry .addViewController ("/" ).setViewName ("forward:/home.htm" );
60- }
61-
6249}
0 commit comments