Skip to content

Commit 427fc01

Browse files
committed
ExamplesApplication ⇒ Lifecycle isn't used, /click not used
1 parent ae1ed76 commit 427fc01

File tree

1 file changed

+28
-11
lines changed

1 file changed

+28
-11
lines changed

examples/src/main/java/org/apache/click/examples/ExamplesApplication.java

Lines changed: 28 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.apache.click.examples;
22

3+
import lombok.extern.slf4j.Slf4j;
34
import lombok.val;
45
import org.apache.click.examples.util.DatabaseInitListener;
56
import org.apache.click.extras.cayenne.DataContextFilter;
@@ -10,6 +11,7 @@
1011
import org.springframework.boot.autoconfigure.SpringBootApplication;
1112
import org.springframework.boot.web.servlet.FilterRegistrationBean;
1213
import org.springframework.boot.web.servlet.ServletRegistrationBean;
14+
import org.springframework.context.Lifecycle;
1315
import org.springframework.context.annotation.Bean;
1416
import org.springframework.context.annotation.ComponentScan;
1517
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
@@ -24,24 +26,23 @@
2426
@SpringBootApplication // (scanBasePackageClasses = { LunaApplication.class, RemoteMvelConsoleController.class })
2527
@EnableWebMvc
2628
@ComponentScan(// == <context:component-scan base-package="org.apache.click.examples" scope-resolver="org.apache.click.extras.spring.PageScopeResolver"/>
27-
basePackages = "org.apache.click.examples",
28-
scopeResolver = PageScopeResolver.class
29+
basePackages = "org.apache.click.examples",
30+
scopeResolver = PageScopeResolver.class
2931
)
30-
public class ExamplesApplication implements WebMvcConfigurer {
31-
32-
public static void main (String[] args) {
32+
@Slf4j
33+
public class ExamplesApplication implements WebMvcConfigurer, Lifecycle {
34+
public static void main (String[] args) {
3335
System.out.println(" *** main thread started *** "+Thread.currentThread());
34-
SpringApplication.run(ExamplesApplication.class, args);
35-
System.err.println(" *** main thread finishes *** "+Thread.currentThread());
36+
SpringApplication.run(ExamplesApplication.class, args);
37+
System.err.println(" *** main thread finishes *** "+Thread.currentThread());
3638
}
37-
3839
private static final String[] CLASSPATH_RESOURCE_LOCATIONS = {
3940
"classpath:/META-INF/resources/",// todo classpath*:
40-
"classpath:/META-INF/resources/click/",
41+
//"classpath:/META-INF/resources/click/",
4142
"classpath:/resources/",
42-
"classpath:/resources/click/",
43+
//"classpath:/resources/click/",
4344
"classpath:/static/",
44-
"classpath:/static/click/",
45+
//"classpath:/static/click/",
4546
"classpath:/public/"
4647
};
4748

@@ -119,4 +120,20 @@ public FilterRegistrationBean<PerformanceFilter> performanceFilter() {
119120
reg.setServletNames(Collections.singletonList("ClickServlet"));
120121
return reg;
121122
}
123+
124+
@Override
125+
public void start () {
126+
log.warn("INFO: ✅ start is called");
127+
}
128+
129+
@Override
130+
public void stop () {
131+
log.warn("INFO: ⛔ stop is called");
132+
}
133+
134+
@Override
135+
public boolean isRunning () {
136+
log.warn("INFO: ❔ isRunning is called");
137+
return false;
138+
}
122139
}

0 commit comments

Comments
 (0)