description:自动发布接口地址注解
+ * + * @author newzhong + * @version 1.0 + */ +@Target({ElementType.TYPE}) +@Retention(RetentionPolicy.RUNTIME) +public @interface AutoPublish { + /** + *description:发布地址
+ * @return String + * @author newzhong + */ + String publishAddress(); +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/CxfConfig.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/CxfConfig.java new file mode 100644 index 0000000..d380fe4 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/CxfConfig.java @@ -0,0 +1,15 @@ +package org.nl.acs.ext.wms.service.wsdl; + +import org.apache.cxf.Bus; +import org.apache.cxf.bus.spring.SpringBus; +import org.apache.cxf.feature.LoggingFeature; +import org.springframework.context.annotation.Bean; + +public class CxfConfig { + @Bean(name = Bus.DEFAULT_BUS_ID) + public SpringBus springBus() { + SpringBus bus = new SpringBus(); + bus.getFeatures().add(new LoggingFeature()); + return bus; + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/IWebServiceTest.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/IWebServiceTest.java new file mode 100644 index 0000000..a350eab --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/IWebServiceTest.java @@ -0,0 +1,10 @@ +package org.nl.acs.ext.wms.service.wsdl; + +import javax.jws.WebParam; +import javax.jws.WebService; + +@WebService(targetNamespace = "http://service.mrxu.com/") +public interface IWebServiceTest { + + String getDept(@WebParam(name = "jsonStr")String jsonStr); +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/PublishEndpoint.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/PublishEndpoint.java new file mode 100644 index 0000000..e3593c6 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/PublishEndpoint.java @@ -0,0 +1,43 @@ +package org.nl.acs.ext.wms.service.wsdl; + +import lombok.extern.slf4j.Slf4j; +import org.apache.cxf.Bus; +import org.apache.cxf.bus.spring.SpringBus; +import org.apache.cxf.jaxws.EndpointImpl; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; +import org.springframework.boot.ApplicationArguments; +import org.springframework.boot.ApplicationRunner; +import org.springframework.stereotype.Component; +import org.springframework.web.context.WebApplicationContext; + + +@Component +@Slf4j +public class PublishEndpoint implements ApplicationRunner { + + @Autowired + private WebApplicationContext applicationConnect; + + @Autowired() + @Qualifier(Bus.DEFAULT_BUS_ID) + private SpringBus bus; + + @SuppressWarnings("resource") + @Override + public void run(ApplicationArguments applicationArguments) throws Exception { + log.info("开始进行自动发布webService接口"); + + String[] beanNames = applicationConnect.getBeanNamesForAnnotation(AutoPublish.class); + for(String beanName : beanNames) { + String publishAddr = applicationConnect.getType(beanName).getAnnotation(AutoPublish.class).publishAddress(); + EndpointImpl endpoint = new EndpointImpl(bus, applicationConnect.getBean(beanName)); + endpoint.publish(publishAddr); + + log.info(String.format("发布接口地址:[%s]", publishAddr)); + } + + log.info("weBservice接口自动发布结束"); + } + +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/Test.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/Test.java new file mode 100644 index 0000000..baef190 --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/Test.java @@ -0,0 +1,8 @@ +package org.nl.acs.ext.wms.service.wsdl; + +public class Test { + + public static void Test(){ + System.out.println("1111"); + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/WebServiceTest.java b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/WebServiceTest.java new file mode 100644 index 0000000..8c2ee9d --- /dev/null +++ b/acs/nladmin-system/src/main/java/org/nl/acs/ext/wms/service/wsdl/WebServiceTest.java @@ -0,0 +1,23 @@ +package org.nl.acs.ext.wms.service.wsdl; + + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import javax.jws.WebService; +import java.util.List; + + +@Service("WebServiceTest") +@AutoPublish(publishAddress = "ACS") +@WebService(endpointInterface = "org.nl.acs.ext.wms.service.wsdl.IWebServiceTest", + serviceName = "WebServiceTest", + targetNamespace = "http://127.0.0.1:8010/WebServiceTest/" +) +public class WebServiceTest implements IWebServiceTest { + + @Override + public String getDept(String jsonStr) { + return "111"; + } +} diff --git a/acs/nladmin-system/src/main/java/org/nl/modules/security/satoken/SaTokenConfigure.java b/acs/nladmin-system/src/main/java/org/nl/modules/security/satoken/SaTokenConfigure.java index ca4c66d..6b8cf7f 100644 --- a/acs/nladmin-system/src/main/java/org/nl/modules/security/satoken/SaTokenConfigure.java +++ b/acs/nladmin-system/src/main/java/org/nl/modules/security/satoken/SaTokenConfigure.java @@ -34,9 +34,9 @@ public class SaTokenConfigure implements WebMvcConfigurer { @Override public void addInterceptors(InterceptorRegistry registry) { // 注册 Sa-Token 拦截器,打开注解式鉴权功能 - registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin())) - .addPathPatterns("/**") - .excludePathPatterns(securityProperties.getExcludes()); // 白名单 +// registry.addInterceptor(new SaInterceptor(handle -> StpUtil.checkLogin())) +// .addPathPatterns("/**") +// .excludePathPatterns(securityProperties.getExcludes()); // 白名单 } }