博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

资料索引

Posted on 2016-01-17 15:12  Co7Co7  阅读(159)  评论(0编辑  收藏  举报

EditPlus注册码在线生成

[转] http://www.jb51.net/tools/editplus/

 

SSL安全认证配置--web.xml

<!-- 此处配置需要强制走SSL安全认证的请求或资源,即使用HTTPS访问URL -->
<security-constraint> 
   <web-resource-collection> 
      <web-resource-name>My-Secure-App</web-resource-name> 
      <url-pattern>/*</url-pattern> 
   </web-resource-collection> 
   <user-data-constraint> 
      <transport-guarantee>CONFIDENTIAL</transport-guarantee> 
   </user-data-constraint> 
</security-constraint> 

 

在Spring项目中,你可能需要从properties文件中读入配置注入到bean中,例如数据库连接信息,memcached server的地址端口信息等,

这些配置信息最好独立于jar包或者war包,这样便于修改配置。Spring提供了PropertyPlaceholderConfigurer类来处理这件事情。

[转] http://outofmemory.cn/code-snippet/3708/spring-properties-file-location

<bean class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer" lazy-init="true">
    <!-- SYSTEM_PROPERTIES_MODE_OVERRIDE这意味着可以从jvm虚拟机的参数中获得配置信息 -->
    <property name="systemPropertiesModeName" value="SYSTEM_PROPERTIES_MODE_OVERRIDE" />
    <!-- value="true" == properties文件如果找不到的话,就可以忽略找不到的文件 -->
    <property name="ignoreResourceNotFound" value="true" />
    <property name="locations">
        <list>
           <value>classpath:/buffalo-service.properties</value>
        </list>
    </property>
</bean>

 

XFire combine with Spring --The first Configuration

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

    <!-- basic configuration -->
    <!-- 若是web.xml已经配置了org/codehaus/xfire/spring/xfire.xml,这里就不需要配置了 -->
    <!-- <import resource="classpath:org/codehaus/xfire/spring/xfire.xml" /> -->
    
    <!-- Service实现类-->
    <bean id="myImpl" class="webjar.foo.MyDispatcherServletXFireImpl" />

    <!-- XFire发布服务核心处理类的配置 -->
    <bean id="MyExporter" class="org.codehaus.xfire.spring.remoting.XFireExporter">
        <property name="serviceFactory" ref="xfire.serviceFactory" />
        <!-- Service实现类 -->
        <property name="serviceBean" ref="myImpl" />
        <!-- Service接口 -->
        <property name="serviceClass" value="webjar.foo.MyDispatcherServletXFire" />
    </bean>
    
    <!-- 结合web.xml配置的DispatcherServlet,配置对外开放的服务访问名称 -->
    <bean
        class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
        <property name="urlMap">
            <map>
                <!-- 客户端访问时使用key的值(IWebJarService)进行调用,而不是MyExporter -->
                <entry key="/IWebJarService">
                    <ref bean="MyExporter" />
                </entry>
            </map>
        </property>
    </bean>
</beans>

 

XFire combine with Spring --The second Configuration {recommend}

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
<beans>

    <!-- basic configuration -->
    <!-- 若是web.xml已经配置了org/codehaus/xfire/spring/xfire.xml,这里就不需要配置了 -->
    <!-- <import resource="classpath:org/codehaus/xfire/spring/xfire.xml" /> -->
    
    <!-- Service实现类-->
    <bean id="myImpl" class="webjar.foo.MyDispatcherServletXFireImpl" />

    <!-- XFire发布服务核心处理类的配置 -->
    <bean name="/IWebJarService" class="org.codehaus.xfire.spring.remoting.XFireExporter">
        <property name="serviceFactory" ref="xfire.serviceFactory" />
        <!-- Service实现类 -->
        <property name="serviceBean" ref="myImpl" />
        <!-- Service接口 -->
        <property name="serviceClass" value="webjar.foo.MyDispatcherServletXFire" />
    </bean>
</beans>