初始化

This commit is contained in:
wangqiy 2025-04-15 18:06:56 +08:00
parent dfdae52bb1
commit 7e4726680f
2 changed files with 35 additions and 17 deletions

View File

@ -1,12 +1,17 @@
package com.agri;
import lombok.extern.slf4j.Slf4j;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.core.env.Environment;
import org.springframework.data.repository.init.ResourceReader;
import org.springframework.scheduling.annotation.EnableScheduling;
import java.io.*;
import java.net.InetAddress;
import java.net.UnknownHostException;
/**
* 启动程序
@ -15,22 +20,35 @@ import java.io.*;
*/
@SpringBootApplication(exclude = { DataSourceAutoConfiguration.class })
@EnableScheduling
public class AdminApplication
{
public static void main(String[] args)
{
SpringApplication.run(AdminApplication.class, args);
InputStream inputStream = ResourceReader.class.getClassLoader().getResourceAsStream("logo.txt");
//打印启动成功logo
if (inputStream != null) {
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
String line;
while ((line = reader.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
e.printStackTrace();
}
@Slf4j
public class AdminApplication {
public static void main(String[] args) {
System.setProperty("spring.devtools.restart.enabled", "false");
ConfigurableApplicationContext applicationContext = SpringApplication.run(AdminApplication.class, args);
Environment env = applicationContext.getEnvironment();
String ip = null;
try {
ip = InetAddress.getLocalHost().getHostAddress();
} catch (UnknownHostException e) {
e.printStackTrace();
}
String port = env.getProperty("server.port");
String path = env.getProperty("server.servlet.context-path");
System.out.println("(♥◠‿◠)ノ゙ 平台PC总后台 启动成功 ლ(´ڡ`ლ)゙ \n" +
" .-------. ____ __ \n" +
" | _ _ \\ \\ \\ / / \n" +
" | ( ' ) | \\ _. / ' \n" +
" |(_ o _) / _( )_ .' \n" +
" | (_,_).' __ ___(_ o _)' \n" +
" | |\\ \\ | || |(_,_)' \n" +
" | | \\ `' /| `-' / \n" +
" | | \\ / \\ / \n" +
" ''-' `'-' `-..-' ");
log.info("\n----------------------------------------------------------\n\t" +
"Application RuoYi is running! Access URLs:\n\t" +
"Local: \t\thttp://localhost:" + port + path + "/\n\t" +
"External: \thttp://" + ip + ":" + port + path + "/\n\t" +
"Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" +
"----------------------------------------------------------");
}
}

View File

@ -1,2 +1,2 @@
青蛙农业版本: ${ruoyi.version}
系统版本: ${ruoyi.version}
SpringBoot版本: ${spring-boot.version}