Sfoglia il codice sorgente

增加thymeleaf视图和远程zheng-ui静态资源视图配置

shuzheng 9 anni fa
parent
commit
d89f742877

+ 1 - 0
zheng-cms/zheng-cms-admin/src/main/resources/config.properties

@@ -1,4 +1,5 @@
 env=${profile.env}
 zheng-ui.version=${zheng-ui.version}
+zheng-ui.path=${zheng-ui.path}
 ### activeMq
 AvtiveMQ.brokerURL=${AvtiveMQ.brokerURL}

+ 1 - 0
zheng-cms/zheng-cms-admin/src/main/resources/profiles/dev.properties

@@ -1,4 +1,5 @@
 profile.env=dev
 zheng-ui.version=1.0.0
+zheng-ui.path=http://ui.zhangshuzheng.cn:1000/
 ### activeMq
 AvtiveMQ.brokerURL=failover:(tcp://127.0.0.1:61616?wireFormat.maxInactivityDuration=0)

+ 1 - 0
zheng-cms/zheng-cms-admin/src/main/resources/profiles/pre.properties

@@ -1,4 +1,5 @@
 profile.env=pre
 zheng-ui.version=1.0.0
+zheng-ui.path=http://ui.zhangshuzheng.cn:1000/
 ### activeMq
 AvtiveMQ.brokerURL=failover:(tcp://127.0.0.1:61616?wireFormat.maxInactivityDuration=0)

+ 1 - 0
zheng-cms/zheng-cms-admin/src/main/resources/profiles/prod.properties

@@ -1,4 +1,5 @@
 profile.env=prod
 zheng-ui.version=1.0.0
+zheng-ui.path=http://ui.zhangshuzheng.cn:1000/
 ### activeMq
 AvtiveMQ.brokerURL=failover:(tcp://127.0.0.1:61616?wireFormat.maxInactivityDuration=0)

+ 1 - 0
zheng-cms/zheng-cms-admin/src/main/resources/profiles/test.properties

@@ -1,4 +1,5 @@
 profile.env=test
 zheng-ui.version=1.0.0
+zheng-ui.path=http://ui.zhangshuzheng.cn:1000/
 ### activeMq
 AvtiveMQ.brokerURL=failover:(tcp://127.0.0.1:61616?wireFormat.maxInactivityDuration=0)

+ 24 - 6
zheng-cms/zheng-cms-admin/src/main/resources/springMVC-servlet.xml

@@ -1,15 +1,15 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xmlns:mvc="http://www.springframework.org/schema/mvc"
-	xsi:schemaLocation="
-        http://www.springframework.org/schema/beans
+	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	   xmlns:mvc="http://www.springframework.org/schema/mvc"
+	   xmlns:context="http://www.springframework.org/schema/context"
+	   xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/mvc
-        http://www.springframework.org/schema/mvc/spring-mvc.xsd">
+        http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
 
 	<!-- 根目录'/'对应页面 -->
-	<mvc:view-controller path="/" view-name="/index"/>
+	<mvc:view-controller path="/" view-name="/index.jsp"/>
 
 	<!-- 拦截器配置 -->
 	<mvc:interceptors>
@@ -24,4 +24,22 @@
 		</mvc:interceptor>
 	</mvc:interceptors>
 
+	<context:property-placeholder location="classpath:config.properties"/>
+
+	<!-- 使用thymeleaf视图 -->
+	<bean id="templateResolver" class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver">
+		<property name="order" value="0"/>
+		<property name="prefix" value="${zheng-ui.path}"/>
+		<property name="suffix" value=".html"/>
+		<property name="templateMode" value="HTML"/>
+		<property name="cacheable" value="false"/>
+	</bean>
+	<bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
+		<property name="templateResolver" ref="templateResolver"/>
+		<property name="enableSpringELCompiler" value="true"/>
+	</bean>
+	<bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
+		<property name="templateEngine" ref="templateEngine"/>
+	</bean>
+
 </beans>

+ 1 - 0
zheng-cms/zheng-cms-web/src/main/resources/config.properties

@@ -1,2 +1,3 @@
 env=${profile.env}
+zheng-ui.path=${zheng-ui.path}
 ehcache.name=zheng-cms-ehcache

+ 1 - 0
zheng-cms/zheng-cms-web/src/main/resources/profiles/dev.properties

@@ -1,3 +1,4 @@
 profile.env=dev
+zheng-ui.path=http://ui.zhangshuzheng.cn:1000/
 ### activeMq
 AvtiveMQ.brokerURL=failover:(tcp://127.0.0.1:61616?wireFormat.maxInactivityDuration=0)

+ 1 - 0
zheng-cms/zheng-cms-web/src/main/resources/profiles/pre.properties

@@ -1,3 +1,4 @@
 profile.env=pre
+zheng-ui.path=http://ui.zhangshuzheng.cn:1000/
 ### activeMq
 AvtiveMQ.brokerURL=failover:(tcp://127.0.0.1:61616?wireFormat.maxInactivityDuration=0)

+ 1 - 0
zheng-cms/zheng-cms-web/src/main/resources/profiles/prod.properties

@@ -1,3 +1,4 @@
 profile.env=prod
+zheng-ui.path=http://ui.zhangshuzheng.cn:1000/
 ### activeMq
 AvtiveMQ.brokerURL=failover:(tcp://127.0.0.1:61616?wireFormat.maxInactivityDuration=0)

+ 1 - 0
zheng-cms/zheng-cms-web/src/main/resources/profiles/test.properties

@@ -1,3 +1,4 @@
 profile.env=test
+zheng-ui.path=http://ui.zhangshuzheng.cn:1000/
 ### activeMq
 AvtiveMQ.brokerURL=failover:(tcp://127.0.0.1:61616?wireFormat.maxInactivityDuration=0)

+ 24 - 6
zheng-cms/zheng-cms-web/src/main/resources/springMVC-servlet.xml

@@ -1,14 +1,32 @@
 <?xml version="1.0" encoding="UTF-8"?>
 <beans xmlns="http://www.springframework.org/schema/beans"
-	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-	xmlns:mvc="http://www.springframework.org/schema/mvc"
-	xsi:schemaLocation="
-        http://www.springframework.org/schema/beans
+	   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	   xmlns:mvc="http://www.springframework.org/schema/mvc"
+	   xmlns:context="http://www.springframework.org/schema/context"
+	   xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/mvc
-        http://www.springframework.org/schema/mvc/spring-mvc.xsd">
+        http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
 
 	<!-- 根目录'/'对应页面 -->
-	<mvc:view-controller path="/" view-name="/index"/>
+	<mvc:view-controller path="/" view-name="/index.jsp"/>
+
+	<context:property-placeholder location="classpath:config.properties"/>
+
+	<!-- 使用thymeleaf视图 -->
+	<bean id="templateResolver" class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver">
+		<property name="order" value="0"/>
+		<property name="prefix" value="${zheng-ui.path}"/>
+		<property name="suffix" value=".html"/>
+		<property name="templateMode" value="HTML"/>
+		<property name="cacheable" value="false"/>
+	</bean>
+	<bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
+		<property name="templateResolver" ref="templateResolver"/>
+		<property name="enableSpringELCompiler" value="true"/>
+	</bean>
+	<bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
+		<property name="templateEngine" ref="templateEngine"/>
+	</bean>
 
 </beans>

+ 1 - 0
zheng-upms/zheng-upms-server/src/main/resources/config.properties

@@ -1,2 +1,3 @@
 env=${profile.env}
+zheng-ui.path=${zheng-ui.path}
 zheng-ui.version=${zheng-ui.version}

+ 2 - 1
zheng-upms/zheng-upms-server/src/main/resources/profiles/dev.properties

@@ -1,2 +1,3 @@
 profile.env=dev
-zheng-ui.version=1.0.0
+zheng-ui.version=1.0.0
+zheng-ui.path=http://ui.zhangshuzheng.cn:1000/

+ 2 - 1
zheng-upms/zheng-upms-server/src/main/resources/profiles/pre.properties

@@ -1,2 +1,3 @@
 profile.env=pre
-zheng-ui.version=1.0.0
+zheng-ui.version=1.0.0
+zheng-ui.path=http://ui.zhangshuzheng.cn:1000/

+ 2 - 1
zheng-upms/zheng-upms-server/src/main/resources/profiles/prod.properties

@@ -1,2 +1,3 @@
 profile.env=prod
-zheng-ui.version=1.0.0
+zheng-ui.version=1.0.0
+zheng-ui.path=http://ui.zhangshuzheng.cn:1000/

+ 2 - 1
zheng-upms/zheng-upms-server/src/main/resources/profiles/test.properties

@@ -1,2 +1,3 @@
 profile.env=test
-zheng-ui.version=1.0.0
+zheng-ui.version=1.0.0
+zheng-ui.path=http://ui.zhangshuzheng.cn:1000/

+ 21 - 3
zheng-upms/zheng-upms-server/src/main/resources/springMVC-servlet.xml

@@ -2,11 +2,11 @@
 <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:mvc="http://www.springframework.org/schema/mvc"
-       xsi:schemaLocation="
-        http://www.springframework.org/schema/beans
+       xmlns:context="http://www.springframework.org/schema/context"
+       xsi:schemaLocation="http://www.springframework.org/schema/beans
         http://www.springframework.org/schema/beans/spring-beans.xsd
         http://www.springframework.org/schema/mvc
-        http://www.springframework.org/schema/mvc/spring-mvc.xsd">
+        http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd">
 
     <!-- 根目录'/'对应页面 -->
     <mvc:view-controller path="/" view-name="/index.jsp"/>
@@ -20,4 +20,22 @@
         </mvc:interceptor>
     </mvc:interceptors>
 
+    <context:property-placeholder location="classpath:config.properties"/>
+
+    <!-- 使用thymeleaf视图 -->
+    <bean id="templateResolver" class="org.thymeleaf.spring4.templateresolver.SpringResourceTemplateResolver">
+        <property name="order" value="0"/>
+        <property name="prefix" value="${zheng-ui.path}"/>
+        <property name="suffix" value=".html"/>
+        <property name="templateMode" value="HTML"/>
+        <property name="cacheable" value="false"/>
+    </bean>
+    <bean id="templateEngine" class="org.thymeleaf.spring4.SpringTemplateEngine">
+        <property name="templateResolver" ref="templateResolver"/>
+        <property name="enableSpringELCompiler" value="true"/>
+    </bean>
+    <bean class="org.thymeleaf.spring4.view.ThymeleafViewResolver">
+        <property name="templateEngine" ref="templateEngine"/>
+    </bean>
+
 </beans>