Browse Source

退回,spring boot admin还是独立一个服务运行比较好

master
白凤吉 3 months ago
parent
commit
3974db47e1
  1. 11
      pom.xml
  2. 24
      src/main/java/a8k/BoditechA800Application.java
  3. 11
      src/main/resources/application.yml

11
pom.xml

@ -111,17 +111,6 @@
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-server</artifactId>
<version>3.3.6</version>
</dependency>
<dependency>
<groupId>de.codecentric</groupId>
<artifactId>spring-boot-admin-starter-client</artifactId>
<version>3.3.6</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-thymeleaf</artifactId>
</dependency>

24
src/main/java/a8k/BoditechA800Application.java

@ -1,35 +1,29 @@
package a8k;
import de.codecentric.boot.admin.server.config.EnableAdminServer;
import org.springframework.core.env.Environment;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationListener;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.EnableAspectJAutoProxy;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;
import org.springframework.core.env.Environment;
@Slf4j
@SpringBootApplication
@EnableAdminServer
public class BoditechA800Application implements ApplicationListener<ContextRefreshedEvent> {
@Resource
private Environment env;
@Resource
private Environment env;
public static void main(String[] args) {
SpringApplication.run(BoditechA800Application.class, args);
public static void main(String[] args) {
SpringApplication.run(BoditechA800Application.class, args);
}
}
@Override public void onApplicationEvent(ContextRefreshedEvent event) {
@Override
public void onApplicationEvent(ContextRefreshedEvent event) {
// if (null == event.getApplicationContext().getParent()) {
// log.info("Springboot加载完成");
// try {
@ -39,5 +33,5 @@ public class BoditechA800Application implements ApplicationListener<ContextRefre
// }
}
}
}

11
src/main/resources/application.yml

@ -7,6 +7,7 @@ device.runmode: "RealMode"
device.enableCanBus: true
iflytophald:
# ip: 192.168.8.10
# ip: 192.168.8.10
ip: 127.0.0.1
cmdch.port: 19004
@ -31,11 +32,6 @@ spring:
jackson:
serialization:
write-dates-as-timestamps: true
boot:
admin:
context-path: /admin
client:
url: http://127.0.0.1/admin
springdoc:
api-docs:
@ -46,8 +42,3 @@ springdoc:
path: /doc/apitest.html # 自定义路径,默认为"/swagger-ui/index.html
operationsSorter: method # 接口按照方法排序
management:
endpoints:
web:
exposure:
include: health,info,loggers,env,metrics
Loading…
Cancel
Save