• WY
    2019-10-08
    请问
    如何修改被 importresource 加载的 xml 文件 (sslconfig.xml)里面定义的变量的 ${servicespecific.service.soap.keypass} ?



    @ImportResource(value = { "classpath:config/sslconfig.xml", "classpath:META-INF/cxf/cxf.xml" })
    public class MyApplication

    这个是我的 sslconfig.xml
    <beans xmlns="http://www.springframework.org/schema/beans"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xmlns:sec="http://cxf.apache.org/configuration/security"
        xmlns:http="http://cxf.apache.org/transports/http/configuration"
        xmlns:httpj="http://cxf.apache.org/transports/http-jetty/configuration"
        xsi:schemaLocation="http://cxf.apache.org/configuration/security http://cxf.apache.org/schemas/configuration/security.xsd http://cxf.apache.org/transports/http/configuration http://cxf.apache.org/schemas/configuration/http-conf.xsd http://cxf.apache.org/transports/http-jetty/configuration http://cxf.apache.org/schemas/configuration/http-jetty.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd">
        <httpj:engine-factory>
            <httpj:engine port="${servicespecific.service.soap.httpsport}">
                <httpj:tlsServerParameters>
                    <sec:keyManagers keyPassword="${servicespecific.service.soap.keypass}">
                        <sec:keyStore file="${servicespecific.service.soap.keystore}" password="${servicespecific.service.soap.keypass}" type="${servicespecific.service.soap.keytype}"/>
                    </sec:keyManagers>
                    <sec:trustManagers>
                        <sec:keyStore file="${servicespecific.service.soap.truststore}" type="${servicespecific.service.soap.keytype}"/>
                    </sec:trustManagers>
                    <!-- sec:clientAuthentication want="true" required="true"/-->
                </httpj:tlsServerParameters>
            </httpj:engine>
        </httpj:engine-factory>
    </beans>
    展开

    作者回复: Spring的占位符替换机制都是类似的,只要有对应的PropertySource,可以找到这些属性值,就能换掉的。

    
    
  • 不能如期而至
    2019-09-25
    这个例子中 通过spring.factories文件注册Bean,是不是也可以通过@Component注解实现同样的功能?

    作者回复: 就这个例子来说,这个EnvironmentPostProcessor还真不能通过其他方式来加载。

    
    
  • DWillQT
    2019-07-06
    666
     1
    
  • lexus
    2019-05-06
    666
    
    
我们在线,来聊聊吧