summaryrefslogtreecommitdiff
path: root/UI source code/dns-dev-2.0/dns-system/src/main/java/com/example/AppRun.java
diff options
context:
space:
mode:
authorunknown <[email protected]>2022-06-24 17:11:23 +0800
committerunknown <[email protected]>2022-06-24 17:11:23 +0800
commit8565e1bb597b481447d33bac6d8c48c2c45215de (patch)
treea4f10c8f7f85a1a8b5c947f7d0d2f967d808a9c4 /UI source code/dns-dev-2.0/dns-system/src/main/java/com/example/AppRun.java
parent8165dfcc7bdb0b2e6f1c05f8e7c93553c0e7911e (diff)
upload UI source codeHEADmain
Diffstat (limited to 'UI source code/dns-dev-2.0/dns-system/src/main/java/com/example/AppRun.java')
-rw-r--r--UI source code/dns-dev-2.0/dns-system/src/main/java/com/example/AppRun.java64
1 files changed, 64 insertions, 0 deletions
diff --git a/UI source code/dns-dev-2.0/dns-system/src/main/java/com/example/AppRun.java b/UI source code/dns-dev-2.0/dns-system/src/main/java/com/example/AppRun.java
new file mode 100644
index 0000000..521f939
--- /dev/null
+++ b/UI source code/dns-dev-2.0/dns-system/src/main/java/com/example/AppRun.java
@@ -0,0 +1,64 @@
+/*
+ * Copyright 2019-2020 Zheng Jie
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.example;
+
+import com.example.utils.SpringContextHolder;
+import io.swagger.annotations.Api;
+import org.springframework.boot.SpringApplication;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+import org.springframework.boot.context.ApplicationPidFileWriter;
+import org.springframework.boot.web.embedded.tomcat.TomcatServletWebServerFactory;
+import org.springframework.boot.web.servlet.server.ServletWebServerFactory;
+import org.springframework.context.annotation.Bean;
+import org.springframework.data.jpa.repository.config.EnableJpaAuditing;
+import org.springframework.scheduling.annotation.EnableAsync;
+import org.springframework.transaction.annotation.EnableTransactionManagement;
+import org.springframework.web.bind.annotation.RestController;
+
+/**
+ * 开启审计功能 -> @EnableJpaAuditing
+ *
+ * 2018/11/15 9:20:19
+ */
+@EnableAsync
+@RestController
+@Api(hidden = true)
+@SpringBootApplication
+@EnableTransactionManagement
+@EnableJpaAuditing(auditorAwareRef = "auditorAware")
+public class AppRun {
+
+ public static void main(String[] args) {
+ SpringApplication springApplication = new SpringApplication(AppRun.class);
+ // 监控应用的PID,启动时可指定PID路径:--spring.pid.file=/home/dns/app.pid
+ // 或者在 application.yml 添加文件路径,方便 kill,kill `cat /home/dns/app.pid`
+ springApplication.addListeners(new ApplicationPidFileWriter());
+ springApplication.run(args);
+ }
+
+ @Bean
+ public SpringContextHolder springContextHolder() {
+ return new SpringContextHolder();
+ }
+
+ @Bean
+ public ServletWebServerFactory webServerFactory() {
+ TomcatServletWebServerFactory fa = new TomcatServletWebServerFactory();
+ fa.addConnectorCustomizers(connector -> connector.setProperty("relaxedQueryChars", "[]{}"));
+ return fa;
+ }
+
+}