zayac-admin/src/main/java/top/charles7c/ContinewAdminApplication.java
2022-12-09 23:51:19 +08:00

49 lines
1.5 KiB
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package top.charles7c;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;
import java.net.InetAddress;
/**
* 启动程序
*
* @author Charles7c
* @since 2022/12/8 23:15
*/
@Slf4j
@RestController
@SpringBootApplication
public class ContinewAdminApplication {
private static Environment env;
@SneakyThrows
public static void main(String[] args) {
SpringApplication application = new SpringApplication(ContinewAdminApplication.class);
ConfigurableApplicationContext context = application.run(args);
env = context.getEnvironment();
log.info("------------------------------------------------------");
log.info("{} backend service started successfully.", env.getProperty("continew-admin.name"));
log.info("后端 API 地址http://{}:{}", InetAddress.getLocalHost().getHostAddress(), env.getProperty("server.port"));
log.info("------------------------------------------------------");
}
/**
* 访问首页提示
*
* @return /
*/
@GetMapping("/")
public String index() {
return String.format("%s backend service started successfully.", env.getProperty("continew-admin.name"));
}
}