@Slf4j @SpringBootApplication @MapperScan({"org.jeecg.**.mapper", "com.sky.**.mapper"}) @EnableTransactionManagement() //@EnableFeignClients(basePackages = {"org.jeecg", "com.sky"}) @ComponentScan(basePackages = {"org.jeecg", "com.sky"}, excludeFilters = @ComponentScan.Filter(type = FilterType.ASSIGNABLE_TYPE, value = {DynamicDataSourceConfig.class, DynamicTenantInterceptor.class})) public class SkyPlatformSystemApplication extends SpringBootServletInitializer { @Override protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { return application.sources(SkyPlatformSystemApplication.class); } /** * 监听器:监听HTTP请求事件 * 解决RequestContextHolder.getRequestAttributes()空指针问题 * * @return */ @Bean public RequestContextListener requestContextListener() { return new RequestContextListener(); } public static void main(String[] args) throws UnknownHostException { // log.info("数据库密码:" + SecurityExtUtil.jiami("sky_mall")); ConfigurableApplicationContext application = SpringApplication.run(SkyPlatformSystemApplication.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 Sky-Platform-Boot is running! Access URLs:\n\t" + "Local: \t\t\thttp://localhost:" + port + path + "/\n\t" + "External: \t\thttp://" + ip + ":" + port + path + "/\n\t" + "Swagger文档: \thttp://" + ip + ":" + port + path + "/doc.html\n" + "-----------------------------------------------------------"); }这是什么意思

时间: 2024-04-16 19:24:42 浏览: 18
这段代码是一个Java Spring Boot应用程序的入口类。它使用了Spring Boot的注解来配置和启动应用程序。 `@Slf4j` 是一个Lombok注解,用于自动生成日志记录器。它简化了在类中创建Logger对象的过程。 `@SpringBootApplication` 是一个组合注解,用于标记主应用程序类。它等效于使用`@Configuration`、`@EnableAutoConfiguration`和`@ComponentScan`这三个注解。 `@MapperScan` 用于扫描指定包下的Mapper接口,通常用于MyBatis配置。 `@EnableTransactionManagement` 启用Spring的事务管理功能。 `@EnableFeignClients` 用于启用Feign客户端,可以进行远程方法调用。 `@ComponentScan` 用于扫描指定包下的组件,包括控制器、服务、仓库等。 `extends SpringBootServletInitializer` 是为了支持将应用程序部署为WAR文件。 `configure()` 方法是为了配置SpringApplicationBuilder以支持WAR文件部署。 `@Bean` 注解用于声明一个bean,这里声明了一个RequestContextListener的实例。 `main()` 方法是应用程序的入口点,通过调用SpringApplication的静态方法`run()` 来启动应用程序。它还获取了应用程序的环境变量,并打印了应用程序的访问URL。 最后,使用`log.info()` 打印了应用程序运行时的访问URL信息。

相关推荐

<?xml version="1.0" encoding="UTF-8"?> <modelVersion>4.0.0</modelVersion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>2.5.5</version> <relativePath/> <groupId>com.de</groupId> <artifactId>debook</artifactId> <version>0.0.1-SNAPSHOT</version> <name>debook</name> <description>Demo project for Spring Boot</description> <java.version>1.8</java.version> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-freemarker</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-devtools</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.mybatis.spring.boot</groupId> <artifactId>mybatis-spring-boot-starter</artifactId> <version>1.3.2</version> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-core</artifactId> <version>1.3.7</version> </dependency> <dependency> <groupId>com.alibaba</groupId> <artifactId>druid-spring-boot-starter</artifactId> <version>1.1.10</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <scope>runtime</scope> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-api</artifactId> <version>1.7.7</version> </dependency> <dependency> <groupId>org.slf4j</groupId> <artifactId>slf4j-log4j12</artifactId> <version>1.7.7</version> </dependency> </dependencies> <build> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.7</version> <configuration> <verbose>true</verbose> <overwrite>true</overwrite> </configuration> </build>

最新推荐

recommend-type

埃森哲制药企业数字化转型项目顶层规划方案glq.pptx

埃森哲制药企业数字化转型项目顶层规划方案glq.pptx
recommend-type

华为OD机试D卷 - 机场航班调度程序 - 免费看解析和代码.html

私信博主免费获取真题解析以及代码
recommend-type

基于FPGA读取设计的心电图代码源码+全部资料齐全.zip

【资源说明】 基于FPGA读取设计的心电图代码源码+全部资料齐全.zip基于FPGA读取设计的心电图代码源码+全部资料齐全.zip 【备注】 1、该项目是高分课程设计项目源码,已获导师指导认可通过,答辩评审分达到95分 2、该资源内项目代码都经过mac/window10/11/linux测试运行成功,功能ok的情况下才上传的,请放心下载使用! 3、本项目适合计算机相关专业(如软件工程、计科、人工智能、通信工程、自动化、电子信息等)的在校学生、老师或者企业员工下载使用,也可作为课程设计、作业、项目初期立项演示等,当然也适合小白学习进阶。 4、如果基础还行,可以在此代码基础上进行修改,以实现其他功能,也可直接用于课设、作业等。 欢迎下载,沟通交流,互相学习,共同进步!
recommend-type

基于Hadoop平台的分布式搜索引擎的设计与实现+部署文档+全部资料 高分项目.zip

【资源说明】 基于Hadoop平台的分布式搜索引擎的设计与实现+部署文档+全部资料 高分项目.zip基于Hadoop平台的分布式搜索引擎的设计与实现+部署文档+全部资料 高分项目.zip 【备注】 1、该项目是个人高分项目源码,已获导师指导认可通过,答辩评审分达到95分 2、该资源内项目代码都经过测试运行成功,功能ok的情况下才上传的,请放心下载使用! 3、本项目适合计算机相关专业(人工智能、通信工程、自动化、电子信息、物联网等)的在校学生、老师或者企业员工下载使用,也可作为毕业设计、课程设计、作业、项目初期立项演示等,当然也适合小白学习进阶。 4、如果基础还行,可以在此代码基础上进行修改,以实现其他功能,也可直接用于毕设、课设、作业等。 欢迎下载,沟通交流,互相学习,共同进步!
recommend-type

华为OD机试D卷 - 数的分解 - 免费看解析和代码.html

私信博主免费获取真题解析以及代码
recommend-type

zigbee-cluster-library-specification

最新的zigbee-cluster-library-specification说明文档。
recommend-type

管理建模和仿真的文件

管理Boualem Benatallah引用此版本:布阿利姆·贝纳塔拉。管理建模和仿真。约瑟夫-傅立叶大学-格勒诺布尔第一大学,1996年。法语。NNT:电话:00345357HAL ID:电话:00345357https://theses.hal.science/tel-003453572008年12月9日提交HAL是一个多学科的开放存取档案馆,用于存放和传播科学研究论文,无论它们是否被公开。论文可以来自法国或国外的教学和研究机构,也可以来自公共或私人研究中心。L’archive ouverte pluridisciplinaire
recommend-type

实现实时数据湖架构:Kafka与Hive集成

![实现实时数据湖架构:Kafka与Hive集成](https://img-blog.csdnimg.cn/img_convert/10eb2e6972b3b6086286fc64c0b3ee41.jpeg) # 1. 实时数据湖架构概述** 实时数据湖是一种现代数据管理架构,它允许企业以低延迟的方式收集、存储和处理大量数据。与传统数据仓库不同,实时数据湖不依赖于预先定义的模式,而是采用灵活的架构,可以处理各种数据类型和格式。这种架构为企业提供了以下优势: - **实时洞察:**实时数据湖允许企业访问最新的数据,从而做出更明智的决策。 - **数据民主化:**实时数据湖使各种利益相关者都可
recommend-type

用 Python 画一个可以动的爱心

好的,我可以帮助您使用Python来绘制一个动态的爱心。您可以使用turtle库来实现。以下是实现代码: ```python import turtle import math # 设置画布和画笔 canvas = turtle.Screen() canvas.bgcolor("black") pencil = turtle.Turtle() pencil.speed(0) pencil.color("red", "pink") pencil.pensize(3) # 定义爱心函数 def draw_love(heart_size, x_offset=0, y_offset=0):
recommend-type

JSBSim Reference Manual

JSBSim参考手册,其中包含JSBSim简介,JSBSim配置文件xml的编写语法,编程手册以及一些应用实例等。其中有部分内容还没有写完,估计有生之年很难看到完整版了,但是内容还是很有参考价值的。