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