다음 요구 사항이 있습니다. 스프링 설정 파일을 통해 http:\\localhost:9080\testws.cls
값을 설정 기 주입으로 전달하고 싶습니다. 이 정적 변수 설정 기 주입은 어떻게 할 수 있습니까? TEST1_WSDL_LOCATION
스프링의 정적 설정 메소드 삽입
public class test1
extends javax.xml.ws.Service
{
private final static URL TEST1_WSDL_LOCATION;
static {
URL url = null;
try {
url = new URL("http:\\localhost:9080\testws.cls");
} catch (MalformedURLException e) {
e.printStackTrace();
}
TEST1_WSDL_LOCATION = url;
}
public test1(URL wsdlLocation, QName serviceName) {
super(wsdlLocation, serviceName);
}
public test1() {
super(TEST1_WSDL_LOCATION, new QName("http://tempuri.org", "test1"));
}
/**
*
* @return
* returns test1Soap
*/
@WebEndpoint(name = "test1Soap")
public Code1Soap getTest1Soap() {
return (Test1Soap)super.getPort(new QName("http://tempuri.org", "Test1Soap"), Test1Soap.class);
}
}
도와주세요.
? 싱글 톤 스코프가있는 객체의 인스턴스 변수로 만들고 일반적인 방법으로 삽입하십시오. –
작업 솔루션은 이미 다른 게시물에서 논의되었습니다. http://stackoverflow.com/questions/2763279/injecting-values-for-static-constants-in-spring. http://www.connorgarvey.com/blog/?p=105도 확인하십시오. 나를 위해 일했다. – spujap