【添加】单体应用开发启动类单独构建为模块
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
<groupId>com.jero.boot</groupId>
|
||||
<artifactId>jero-boot-base-core</artifactId>
|
||||
</dependency>
|
||||
<!-- 引入微服务启动依赖 starter
|
||||
<!-- 如果需要微服务版本,则引入微服务启动依赖 starter
|
||||
<dependency>
|
||||
<groupId>com.jero.boot</groupId>
|
||||
<artifactId>jero-boot-starter-cloud</artifactId>
|
||||
|
||||
@@ -38,16 +38,6 @@
|
||||
<groupId>com.jero.boot</groupId>
|
||||
<artifactId>jero-boot-starter-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jero.boot</groupId>
|
||||
<artifactId>jero-boot-module-demo</artifactId>
|
||||
<version>${jero.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jero.boot</groupId>
|
||||
<artifactId>jero-boot-base-generater</artifactId>
|
||||
<version>${jero.version}</version>
|
||||
</dependency>
|
||||
<!-- 积木报表 -->
|
||||
<dependency>
|
||||
<groupId>com.jimureport</groupId>
|
||||
@@ -62,16 +52,5 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<!--微服务模式下修改为true,跳过此打包插件,否则微服务模块无法引用-->
|
||||
<skip>false</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
+40
-40
@@ -1,40 +1,40 @@
|
||||
package com.jero;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* 单体启动类(采用此类启动为单体模式)
|
||||
*/
|
||||
@Slf4j
|
||||
@SpringBootApplication
|
||||
public class JeroSystemApplication extends SpringBootServletInitializer {
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(JeroSystemApplication.class);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws UnknownHostException {
|
||||
ConfigurableApplicationContext application = SpringApplication.run(JeroSystemApplication.class, args);
|
||||
Environment env = application.getEnvironment();
|
||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||
String port = env.getProperty("server.port");
|
||||
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path"));
|
||||
log.info("\n----------------------------------------------------------\n\t" +
|
||||
"Application jero-boot 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" +
|
||||
"----------------------------------------------------------");
|
||||
}
|
||||
}
|
||||
//package com.jero;
|
||||
//
|
||||
//import lombok.extern.slf4j.Slf4j;
|
||||
//import com.jero.common.util.oConvertUtils;
|
||||
//import org.springframework.boot.SpringApplication;
|
||||
//import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
//import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
//import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
//import org.springframework.context.ConfigurableApplicationContext;
|
||||
//import org.springframework.core.env.Environment;
|
||||
//
|
||||
//import java.net.InetAddress;
|
||||
//import java.net.UnknownHostException;
|
||||
//
|
||||
///**
|
||||
//* 单体启动类(采用此类启动为单体模式)
|
||||
//*/
|
||||
//@Slf4j
|
||||
//@SpringBootApplication
|
||||
//public class JeroSystemApplication extends SpringBootServletInitializer {
|
||||
//
|
||||
// @Override
|
||||
// protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
// return application.sources(JeroSystemApplication.class);
|
||||
// }
|
||||
//
|
||||
// public static void main(String[] args) throws UnknownHostException {
|
||||
// ConfigurableApplicationContext application = SpringApplication.run(JeroSystemApplication.class, args);
|
||||
// Environment env = application.getEnvironment();
|
||||
// String ip = InetAddress.getLocalHost().getHostAddress();
|
||||
// String port = env.getProperty("server.port");
|
||||
// String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path"));
|
||||
// log.info("\n----------------------------------------------------------\n\t" +
|
||||
// "Application jero-boot 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" +
|
||||
// "----------------------------------------------------------");
|
||||
// }
|
||||
//}
|
||||
@@ -0,0 +1,45 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<parent>
|
||||
<artifactId>jero-boot</artifactId>
|
||||
<groupId>com.jero.boot</groupId>
|
||||
<version>2.4.2</version>
|
||||
</parent>
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
|
||||
<artifactId>jero-boot-single-startup</artifactId>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.jero.boot</groupId>
|
||||
<artifactId>jero-boot-module-system</artifactId>
|
||||
<version>${jero.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jero.boot</groupId>
|
||||
<artifactId>jero-boot-module-demo</artifactId>
|
||||
<version>${jero.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.jero.boot</groupId>
|
||||
<artifactId>jero-boot-base-generater</artifactId>
|
||||
<version>${jero.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<configuration>
|
||||
<!--微服务模式下修改为true,跳过此打包插件,否则微服务模块无法引用-->
|
||||
<skip>false</skip>
|
||||
</configuration>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
package com.jero;
|
||||
|
||||
import com.jero.common.util.oConvertUtils;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.boot.builder.SpringApplicationBuilder;
|
||||
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
|
||||
import org.springframework.context.ConfigurableApplicationContext;
|
||||
import org.springframework.core.env.Environment;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
|
||||
/**
|
||||
* @Description 单体应用启动类
|
||||
* @Author zero
|
||||
* @Date 2021/3/15
|
||||
**/
|
||||
@Slf4j
|
||||
@SpringBootApplication
|
||||
public class JeroSystemSingleApplication extends SpringBootServletInitializer {
|
||||
|
||||
@Override
|
||||
protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
|
||||
return application.sources(JeroSystemSingleApplication.class);
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws UnknownHostException {
|
||||
ConfigurableApplicationContext application = SpringApplication.run(JeroSystemSingleApplication.class, args);
|
||||
Environment env = application.getEnvironment();
|
||||
String ip = InetAddress.getLocalHost().getHostAddress();
|
||||
String port = env.getProperty("server.port");
|
||||
String path = oConvertUtils.getString(env.getProperty("server.servlet.context-path"));
|
||||
log.info("\n----------------------------------------------------------\n\t" +
|
||||
"Application jero-boot 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" +
|
||||
"----------------------------------------------------------");
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user