远程模式依赖注入
This commit is contained in:
@@ -252,6 +252,9 @@ public abstract class NodeServer {
|
||||
@Override
|
||||
public Object load(ResourceFactory rf, String srcResourceName, final Object srcObj, final String resourceName, Field field, final Object attachment) {
|
||||
try {
|
||||
if ((srcObj instanceof Service) && Sncp.isRemote((Service) srcObj)) {
|
||||
return null; //远程模式不得注入
|
||||
}
|
||||
Service nodeService = rf.find(resourceName, WebSocketNode.class);
|
||||
if (nodeService == null) {
|
||||
final HashSet<String> groups = new HashSet<>();
|
||||
@@ -298,6 +301,9 @@ public abstract class NodeServer {
|
||||
if (resServiceType.getAnnotation(Local.class) == null) {
|
||||
return null;
|
||||
}
|
||||
if ((srcObj instanceof Service) && Sncp.isRemote((Service) srcObj)) {
|
||||
return null; //远程模式不得注入 AutoLoad Service
|
||||
}
|
||||
boolean auto = true;
|
||||
AutoLoad al = resServiceType.getAnnotation(AutoLoad.class);
|
||||
if (al != null) {
|
||||
|
||||
@@ -512,6 +512,9 @@ public class SourceModuleEngine extends ModuleEngine implements SourceManager {
|
||||
@Override
|
||||
public Object load(ResourceFactory rf, String srcResourceName, final Object srcObj, final String resourceName, Field field, final Object attachment) {
|
||||
try {
|
||||
if ((srcObj instanceof Service) && Sncp.isRemote((Service) srcObj)) {
|
||||
return null; //远程模式不得注入
|
||||
}
|
||||
DataSource source = loadDataSource(resourceName, false);
|
||||
field.set(srcObj, source);
|
||||
return source;
|
||||
@@ -527,6 +530,9 @@ public class SourceModuleEngine extends ModuleEngine implements SourceManager {
|
||||
@Override
|
||||
public Object load(ResourceFactory rf, String srcResourceName, final Object srcObj, final String resourceName, Field field, final Object attachment) {
|
||||
try {
|
||||
if ((srcObj instanceof Service) && Sncp.isRemote((Service) srcObj)) {
|
||||
return null; //远程模式不得注入
|
||||
}
|
||||
if (srcObj instanceof Servlet) {
|
||||
throw new RedkaleException("CacheSource cannot inject in Servlet " + srcObj);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user