File tree 2 files changed +38
-0
lines changed
2 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -213,6 +213,43 @@ export class UndefinedBean implements IBean {
213
213
public readonly exceptions : string [ ] = [ ] ;
214
214
}
215
215
216
+ export class ApplicationContextBean implements IBean {
217
+ private static readonly typeName = "org.springframework.context.ApplicationContext" ;
218
+ private static readonly id = "fakedDiApplicationContext" ;
219
+ public readonly name = ApplicationContextBean . id ;
220
+ public readonly IsAnonymous = true ;
221
+
222
+ private constructor ( ) {
223
+ Repository . registerBean ( this ) ;
224
+ Repository . registerIdForClass ( ApplicationContextBean . typeName , ApplicationContextBean . id ) ;
225
+ }
226
+
227
+ public static register ( ) {
228
+ const bean = Repository . tryGet ( ApplicationContextBean . id ) ;
229
+ if ( bean !== undefined )
230
+ return bean ;
231
+ return new ApplicationContextBean ( ) ;
232
+ }
233
+
234
+ public get getter ( ) : string {
235
+ return `get${ upperInitialChar ( ApplicationContextBean . id ) } ` ;
236
+ }
237
+
238
+ public get javaMembers ( ) : Member [ ] {
239
+ return [
240
+ new Method (
241
+ `public static ${ ApplicationContextBean . typeName } ${ this . getter } ()` ,
242
+ [
243
+ new Return ( new Symbol ( "this" ) ) ,
244
+ ] ,
245
+ [ ] ) ,
246
+ new BlankLine ( ) ,
247
+ ] ;
248
+ }
249
+
250
+ public readonly exceptions : string [ ] = [ ] ;
251
+ }
252
+
216
253
export namespace Repository {
217
254
const beans = new NameMap < IBean > ( ) ;
218
255
Original file line number Diff line number Diff line change @@ -4,6 +4,7 @@ import * as jsonParser from "./parseJson";
4
4
import * as xmlParser from "./parseSpringXml" ;
5
5
6
6
export default async function parseSpringConfigFiles ( filePaths : string [ ] ) {
7
+ model . ApplicationContextBean . register ( ) ;
7
8
await collectBeansFromConfigFiles ( filePaths ) ;
8
9
model . Repository . checkAliases ( xmlParser . beanWithIdExists ) ;
9
10
xmlParser . parseAllBeans ( ) ;
You can’t perform that action at this time.
0 commit comments