liusw 7 жил өмнө
parent
commit
068f452407

+ 59 - 1
pom.xml

@@ -132,9 +132,25 @@
             <scope>test</scope>
         </dependency>
 
-
+        <dependency>
+            <groupId>com.usoft.framework</groupId>
+            <artifactId>usoft-cat-utils</artifactId>
+            <version>${spring.active.profile}-1.2-SNAPSHOT</version>
+        </dependency>
     </dependencies>
 
+    <dependencyManagement>
+        <dependencies>
+            <dependency>
+                <groupId>com.usoft.framework</groupId>
+                <artifactId>usoft-base-dependencies</artifactId>
+                <version>${spring.active.profile}-1.2-SNAPSHOT</version>
+                <type>pom</type>
+                <scope>import</scope>
+            </dependency>
+        </dependencies>
+    </dependencyManagement>
+
     <build>
         <plugins>
             <plugin>
@@ -150,4 +166,46 @@
             </plugin>
         </plugins>
     </build>
+
+    <!-- 项目运行环境 -->
+    <profiles>
+        <profile>
+            <!-- 开发环境 -->
+            <id>dev</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <properties>
+                <spring.active.profile>dev</spring.active.profile>
+            </properties>
+        </profile>
+        <profile>
+            <!-- 测试环境 -->
+            <id>test</id>
+            <properties>
+                <spring.active.profile>test</spring.active.profile>
+            </properties>
+        </profile>
+        <profile>
+            <!-- 生产环境 -->
+            <id>prod</id>
+            <properties>
+                <spring.active.profile>prod</spring.active.profile>
+            </properties>
+        </profile>
+        <profile>
+            <!-- 预部署 -->
+            <id>pre</id>
+            <properties>
+                <spring.active.profile>pre</spring.active.profile>
+            </properties>
+        </profile>
+        <profile>
+            <!-- 预部署测试 -->
+            <id>ptest</id>
+            <properties>
+                <spring.active.profile>ptest</spring.active.profile>
+            </properties>
+        </profile>
+    </profiles>
 </project>

+ 30 - 0
src/main/java/com/uas/ps/inquiry/GlobalInterceptorConfiguration.java

@@ -0,0 +1,30 @@
+package com.uas.ps.inquiry;
+
+import com.dianping.cat.servlet.CatFilter;
+import org.springframework.boot.web.servlet.FilterRegistrationBean;
+import org.springframework.context.annotation.Bean;
+import org.springframework.context.annotation.Configuration;
+
+/**
+ * 服务全局拦截器
+ * Created by canyiwang on 2017/7/14.
+ */
+@Configuration
+public class GlobalInterceptorConfiguration {
+
+	/**
+     * CAT URL过滤器
+	 *
+	 * @return
+	 */
+	@Bean
+	public FilterRegistrationBean catFilter() {
+		FilterRegistrationBean registration = new FilterRegistrationBean();
+		CatFilter filter = new CatFilter();
+		registration.setFilter(filter);
+		registration.addUrlPatterns("/*");
+		registration.setName("cat-filter");
+		registration.setOrder(1);
+		return registration;
+	}
+}

+ 1 - 0
src/main/resources/META-INF/app.properties

@@ -0,0 +1 @@
+app.name=mall-inquiry

+ 4 - 1
src/main/resources/application.yml

@@ -13,4 +13,7 @@ sso:
 
 security:
  basic:
-  enabled: false
+  enabled: false
+
+server:
+ port: 7070

+ 2 - 2
src/main/resources/config/application-dev.properties

@@ -1,5 +1,5 @@
-spring.datasource.url=jdbc:mysql://192.168.253.12:3306/mall_test_dev?characterEncoding=utf-8&useSSL=false&autoReconnect=true&failOverReadOnly=false
-spring.datasource.username=root
+spring.datasource.url=jdbc:mysql://188.131.128.107:3306/mall_test_dev?characterEncoding=utf-8&useSSL=false&autoReconnect=true&failOverReadOnly=false
+spring.datasource.username=sa
 spring.datasource.password=select111***
 spring.datasource.driverClassName=com.mysql.jdbc.Driver
 spring.datasource.type=com.zaxxer.hikari.HikariDataSource

+ 4 - 0
src/main/resources/logback.xml

@@ -33,9 +33,13 @@
         </encoder>
     </appender>
 
+    <!--CAT日志上报-->
+    <appender name="CatAppender" class="com.usoft.cat.utils.CatLogbackAppender"></appender>
+
     <root level="INFO">
         <appender-ref ref="async"/>
         <appender-ref ref="stdout" />
+        <appender-ref ref="CatAppender" />
     </root>