fix: continer Autowired error
Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
parent
0568a7abbe
commit
da9e2063ca
@ -1,4 +1,4 @@
|
|||||||
import { provideSingleton, Autowired } from '@ccms/container'
|
import { provideSingleton, Autowired, optional } from '@ccms/container'
|
||||||
import { channel } from './channel'
|
import { channel } from './channel'
|
||||||
|
|
||||||
export namespace proxy {
|
export namespace proxy {
|
||||||
@ -147,6 +147,7 @@ export namespace proxy {
|
|||||||
}
|
}
|
||||||
@provideSingleton(BungeeCord)
|
@provideSingleton(BungeeCord)
|
||||||
export class BungeeCord {
|
export class BungeeCord {
|
||||||
|
@optional()
|
||||||
@Autowired()
|
@Autowired()
|
||||||
private channel: channel.Channel
|
private channel: channel.Channel
|
||||||
/**
|
/**
|
||||||
|
@ -66,7 +66,7 @@ export const Autowired = (className?: any) => {
|
|||||||
return inject(className)(target, propertyKey, index)
|
return inject(className)(target, propertyKey, index)
|
||||||
}
|
}
|
||||||
let type = Reflect.getMetadata('design:type', target, propertyKey)
|
let type = Reflect.getMetadata('design:type', target, propertyKey)
|
||||||
if (type && type !== Object && Java.isJavaObject(type)) {
|
if (type && type !== Object && !Java.isJavaObject(type)) {
|
||||||
inject(type)(target, propertyKey, index)
|
inject(type)(target, propertyKey, index)
|
||||||
named(className || propertyKey)(target, propertyKey, index)
|
named(className || propertyKey)(target, propertyKey, index)
|
||||||
} else if (container.isBound(ioc.Autowired)) {
|
} else if (container.isBound(ioc.Autowired)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user