gitlab-runner-gateway/src/main/java/tk/antoine_roux/wiki/MainLauncher.java

39 lines
1.2 KiB
Java
Raw Normal View History

2020-08-12 06:41:28 +00:00
package tk.antoine_roux.wiki;
2020-08-12 22:41:34 +00:00
import org.springframework.beans.factory.annotation.Value;
2020-08-12 06:41:28 +00:00
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.annotation.Bean;
import org.springframework.web.servlet.function.RouterFunction;
import org.springframework.web.servlet.function.RouterFunctions;
import org.springframework.web.servlet.function.ServerResponse;
/**
* Main class
*/
2020-08-12 22:41:34 +00:00
// force spring application to not use glibc or any non jdk code which is bad for graalvm
@SpringBootApplication(proxyBeanMethods = false)
2020-08-12 06:41:28 +00:00
public class MainLauncher {
2020-08-12 22:41:34 +00:00
@Value("${wikiproject.basePath}")
private String basePath;
/**
* Entrypoint for application
2020-08-12 06:41:28 +00:00
*/
public static void main(String[] args) {
SpringApplication.run(MainLauncher.class, args);
}
2020-08-12 22:41:34 +00:00
/**
* Routing declaration
*/
2020-08-12 06:41:28 +00:00
@Bean
public RouterFunction<ServerResponse> routes() {
return RouterFunctions.route()
2020-08-12 22:41:34 +00:00
.GET(this.basePath + "/hello", serverRequest ->
ServerResponse.ok().body("Hello world !")
).build();
2020-08-12 06:41:28 +00:00
}
}