wsdl_ip.properties:
person=http://localhost:8080/CXF_3/cxf/person?wsdl
---------------------------------------------------------------------
IpPortUtils.java
package cn.itcast.cxf.service.utils;
import java.io.InputStream;
import java.util.Properties;
import org.apache.cxf.common.util.StringUtils;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
public class IpPortUtils {
public static String getIpPort(String key) {
try {
Resource resource = new ClassPathResource("cn/itcast/cxf/service/wsdl_ip.properties");
InputStream inputStream = resource.getInputStream();
Properties p = new Properties();
p.load(inputStream);
String ip = p.getProperty(key);
System.out.println("get WSDL("+key+") ip:[" + ip +"]");
return StringUtils.isEmpty(ip) ? "http://localhost:80" : ip;
} catch (Exception e) {
e.printStackTrace();
return "http://localhost:80";
}
}
}