张延森 3 년 전
부모
커밋
1d2656d7e2

+ 16
- 0
src/main/java/com/yunzhi/training/config/LazyInitBean.java 파일 보기

@@ -0,0 +1,16 @@
1
+package com.yunzhi.training.config;
2
+
3
+import org.springframework.beans.BeansException;
4
+import org.springframework.beans.factory.config.BeanFactoryPostProcessor;
5
+import org.springframework.beans.factory.config.ConfigurableListableBeanFactory;
6
+import org.springframework.context.annotation.Configuration;
7
+
8
+@Configuration
9
+public class LazyInitBean implements BeanFactoryPostProcessor {
10
+    @Override
11
+    public void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory) throws BeansException {
12
+        for (String beanName : beanFactory.getBeanDefinitionNames()) {
13
+            beanFactory.getBeanDefinition(beanName).setLazyInit(true);
14
+        }
15
+    }
16
+}

src/main/java/com/yunzhi/training/config/SwagggerConfig.java → src/main/java/com/yunzhi/training/config/SwaggerConfig.java 파일 보기

@@ -11,7 +11,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
11 11
 
12 12
 @Configuration
13 13
 @EnableSwagger2
14
-public class SwagggerConfig {
14
+public class SwaggerConfig {
15 15
     @Bean
16 16
     public Docket docket() {
17 17
         return new Docket(DocumentationType.SWAGGER_2)

+ 5
- 0
src/main/resources/application-dev.yml 파일 보기

@@ -14,3 +14,8 @@ logging:
14 14
   level:
15 15
     root: info
16 16
     springfox: info
17
+
18
+### swagger
19
+springfox:
20
+  documentation:
21
+    auto-startup: true

+ 5
- 7
src/main/resources/application-prod.yml 파일 보기

@@ -12,10 +12,8 @@ spring:
12 12
     password: shigongli@123
13 13
 
14 14
 
15
-weixin:
16
-  miniapp:
17
-    appid:
18
-    secret:
19
-    token:
20
-    aesKey:
21
-    msgDataFormat: JSON
15
+
16
+##
17
+springfox:
18
+  documentation:
19
+    auto-startup: false

+ 1
- 1
src/main/resources/application.yml 파일 보기

@@ -14,7 +14,7 @@ interceptor:
14 14
       - /**/captcha
15 15
       - /swagger-ui/**
16 16
       - /swagger-resources/**
17
-      - /v2/**
17
+      - /**/api-docs
18 18
       - /test-weather
19 19
 
20 20
 ###