初步实现一个使用Spring框架的Demo Web模块
This commit is contained in:
2
weixin-java-demo-with-spring/src/main/resources/.gitignore
vendored
Normal file
2
weixin-java-demo-with-spring/src/main/resources/.gitignore
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
/wx-gzh1.properties
|
||||
/wx-gzh2.properties
|
||||
@@ -0,0 +1,17 @@
|
||||
<?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"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
|
||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
|
||||
|
||||
<import resource="classpath*:spring-service-bean.xml" />
|
||||
|
||||
<util:properties id="gzh1WxProperties" location="classpath:/wx-gzh1.properties" />
|
||||
<util:properties id="gzh2WxProperties" location="classpath:/wx-gzh2.properties" />
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,8 @@
|
||||
log4j.rootLogger=DEBUG, stdout
|
||||
|
||||
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
|
||||
log4j.appender.stdout.Target=System.out
|
||||
log4j.appender.stdout.layout=org.apache.log4j.EnhancedPatternLayout
|
||||
log4j.appender.stdout.layout.ConversionPattern=[%-5p] %d{yyyy-MM-dd HH:mm:ss,SSS} [%t]:%c:%L#%M() %m%n
|
||||
|
||||
log4j.logger.org.apache.http.impl.conn.PoolingHttpClientConnectionManager=INFO
|
||||
@@ -0,0 +1,29 @@
|
||||
<?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:context="http://www.springframework.org/schema/context"
|
||||
xmlns:amq="http://activemq.apache.org/schema/core" xmlns:util="http://www.springframework.org/schema/util"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/util http://www.springframework.org/schema/util/spring-util.xsd">
|
||||
|
||||
<context:component-scan base-package="com.github.binarywang.demo.spring">
|
||||
<context:exclude-filter type="annotation"
|
||||
expression="org.springframework.stereotype.Controller" />
|
||||
</context:component-scan>
|
||||
|
||||
<bean id="restTemplate" class="org.springframework.web.client.RestTemplate">
|
||||
<property name="messageConverters">
|
||||
<list>
|
||||
<bean
|
||||
class="org.springframework.http.converter.StringHttpMessageConverter">
|
||||
<constructor-arg>
|
||||
<value>UTF-8</value>
|
||||
</constructor-arg>
|
||||
</bean>
|
||||
<bean
|
||||
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter" />
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,43 @@
|
||||
<?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"
|
||||
xmlns:context="http://www.springframework.org/schema/context"
|
||||
xmlns:aop="http://www.springframework.org/schema/aop" xmlns:task="http://www.springframework.org/schema/task"
|
||||
xsi:schemaLocation="http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd
|
||||
http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd
|
||||
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
|
||||
http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd
|
||||
http://www.springframework.org/schema/task http://www.springframework.org/schema/task/spring-task.xsd">
|
||||
<!-- only scan the Controller class for web context -->
|
||||
<context:component-scan base-package="com.github.binarywang.demo.spring">
|
||||
<context:include-filter type="annotation"
|
||||
expression="org.springframework.stereotype.Controller" />
|
||||
</context:component-scan>
|
||||
|
||||
<mvc:annotation-driven>
|
||||
<mvc:message-converters>
|
||||
<ref bean="jsonConverter" />
|
||||
<ref bean="stringHttpMessageConverter" />
|
||||
</mvc:message-converters>
|
||||
</mvc:annotation-driven>
|
||||
|
||||
<mvc:default-servlet-handler />
|
||||
|
||||
<bean id="stringHttpMessageConverter"
|
||||
class="org.springframework.http.converter.StringHttpMessageConverter">
|
||||
<property name="supportedMediaTypes">
|
||||
<list>
|
||||
<value>text/html;charset=UTF-8</value>
|
||||
<value>text/plain;charset=UTF-8</value>
|
||||
</list>
|
||||
</property>
|
||||
</bean>
|
||||
|
||||
<bean id="jsonConverter"
|
||||
class="org.springframework.http.converter.json.MappingJackson2HttpMessageConverter">
|
||||
<property name="supportedMediaTypes" value="application/json" />
|
||||
</bean>
|
||||
|
||||
<aop:aspectj-autoproxy proxy-target-class="true" />
|
||||
|
||||
</beans>
|
||||
@@ -0,0 +1,3 @@
|
||||
wx_appid=
|
||||
wx_appsecret=
|
||||
wx_token=
|
||||
@@ -0,0 +1,3 @@
|
||||
wx_appid=
|
||||
wx_appsecret=
|
||||
wx_token=
|
||||
Reference in New Issue
Block a user