ylx 7 years ago
parent
commit
3ec6fd7c54

+ 1 - 0
saicLogistics/.settings/org.eclipse.core.resources.prefs

@@ -1,3 +1,4 @@
 eclipse.preferences.version=1
+encoding//src/main/resources/basicInfo.properties=UTF-8
 encoding//src/main/resources/conf.properties=UTF-8
 encoding/<project>=UTF-8

+ 3 - 1
saicLogistics/src/main/java/com/fuzamei/web/OrdersIssueAction.java

@@ -4,6 +4,7 @@ import java.util.List;
 import java.util.Map;
 
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.web.bind.annotation.RequestBody;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -39,7 +40,8 @@ public class OrdersIssueAction {
 	@Autowired
 	private BoxService boxService;
 	
-	private Integer rowNum = 10;
+	@Value(value="${basicInfo.rowNum}")
+	private Integer rowNum;
 	
 	/**
 	 * 

+ 14 - 4
saicLogistics/src/main/resources/applicationContext.xml

@@ -14,12 +14,22 @@
                         http://www.springframework.org/schema/aop 
                         http://www.springframework.org/schema/aop/spring-aop-4.3.xsd" >  
 	
+	<!-- 加载配置文件 -->
+    <bean id="propertyConfigurer" class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
+        <property name="locations">
+            <list>
+                <value>classpath:jdbc.properties</value>
+                <value>classpath:basicInfo.properties</value>
+            </list>
+        </property>
+    </bean>
+	
 	<!-- 数据源的配置 -->
 	<bean id = "dataSource" class="org.apache.commons.dbcp.BasicDataSource">
-		<property name="driverClassName" value = "com.mysql.jdbc.Driver"></property>
-		<property name="url" value = "jdbc:mysql://118.178.58.178:3306/sq_logistics?useUnicode=true&amp;characterEncoding=UTF-8"></property>
-		<property name="username" value = "root"></property>
-		<property name="password" value = "sql345678"></property>
+		<property name="driverClassName" value = "${jdbc.driver}"></property>
+		<property name="url" value = "${jdbc.url}"></property>
+		<property name="username" value = "${jdbc.username}"></property>
+		<property name="password" value = "${jdbc.password}"></property>
 	</bean>
 	
 	<!-- session工厂 -->

+ 2 - 0
saicLogistics/src/main/resources/basicInfo.properties

@@ -0,0 +1,2 @@
+#分页每页显示条数
+basicInfo.rowNum=10

+ 4 - 0
saicLogistics/src/main/resources/jdbc.properties

@@ -0,0 +1,4 @@
+jdbc.driver=com.mysql.jdbc.Driver
+jdbc.url=jdbc:mysql://118.178.58.178:3306/sq_logistics?useUnicode=true&characterEncoding=UTF-8
+jdbc.username=root
+jdbc.password=sql345678