This commit is contained in:
wentch
2016-01-08 12:46:56 +08:00
parent 6f4f92deb2
commit 3f0c64376d
2 changed files with 3 additions and 3 deletions

View File

@@ -315,7 +315,7 @@ public abstract class NodeServer {
diffGroupAddrs.forEach((k, v) -> diffGroupTransports.add(loadTransport(k, server.getProtocol(), v)));
final boolean localed = (sameGroupAddrs.isEmpty() && diffGroupAddrs.isEmpty()) || sameGroupAddrs.contains(this.sncpAddress) || type.getAnnotation(LocalService.class) != null;//本地模式
if (localed && (type.isInterface() || Modifier.isAbstract(type.getModifiers()))) continue; //本地模式不能实例化接口和抽象类的Service类
final ServiceType st = type.getAnnotation(ServiceType.class);
final ServiceResource st = type.getAnnotation(ServiceResource.class);
final Class<? extends Service> resType = st == null ? type : st.value();
if (st != null && (!isSNCP() && factory.find(entry.getName(), resType) != null)) continue;
ServiceWrapper wrapper;

View File

@@ -15,7 +15,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
* 业务逻辑的Service通常有两种编写方式
* 1只写一个Service实现类
* 2先定义业务的Service接口或抽象类再编写具体实现类
* &#64;ServiceType用于第二种方式 在具体实现类上需要使用&#64;ServiceType指明资源注入的类型
* &#64;ServiceResource用于第二种方式 在具体实现类上需要使用&#64;ServiceResource指明资源注入的类型
* </pre></blockquote>
* <p>
* 详情见: http://www.redkale.org
@@ -26,7 +26,7 @@ import static java.lang.annotation.RetentionPolicy.RUNTIME;
@Documented
@Target({TYPE})
@Retention(RUNTIME)
public @interface ServiceType {
public @interface ServiceResource {
Class<? extends Service> value();