zno2

spring 如何解析 xml 中的元素

org.springframework.beans.factory.xml.BeanDefinitionParser
 
举例说明:
<tx:annotation-driven transaction-manager="txManager" />

 

org.springframework.transaction.config.AnnotationDrivenBeanDefinitionParser
 
Thread [main] (Suspended (breakpoint at line 48 in TxNamespaceHandler))	
	owns: DefaultContextCache  (id=43)	
	TxNamespaceHandler.getTransactionManagerName(Element) line: 48	
	AnnotationDrivenBeanDefinitionParser.registerTransactionManager(Element, BeanDefinition) line: 87	
	AnnotationDrivenBeanDefinitionParser.access$000(Element, BeanDefinition) line: 51	
	AnnotationDrivenBeanDefinitionParser$AopAutoProxyConfigurer.configureAutoProxyCreator(Element, ParserContext) line: 121	
	AnnotationDrivenBeanDefinitionParser.parse(Element, ParserContext) line: 68	
	TxNamespaceHandler(NamespaceHandlerSupport).parse(Element, ParserContext) line: 74	
	BeanDefinitionParserDelegate.parseCustomElement(Element, BeanDefinition) line: 1411	
	BeanDefinitionParserDelegate.parseCustomElement(Element) line: 1401	
	DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(Element, BeanDefinitionParserDelegate) line: 172	
	DefaultBeanDefinitionDocumentReader.doRegisterBeanDefinitions(Element) line: 142	
	DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(Document, XmlReaderContext) line: 94	
	XmlBeanDefinitionReader.registerBeanDefinitions(Document, Resource) line: 508	
	XmlBeanDefinitionReader.doLoadBeanDefinitions(InputSource, Resource) line: 392	
	XmlBeanDefinitionReader.loadBeanDefinitions(EncodedResource) line: 336	
	XmlBeanDefinitionReader.loadBeanDefinitions(Resource) line: 304	
	XmlBeanDefinitionReader(AbstractBeanDefinitionReader).loadBeanDefinitions(Resource...) line: 181	
	XmlBeanDefinitionReader(AbstractBeanDefinitionReader).loadBeanDefinitions(String, Set<Resource>) line: 217	
	XmlBeanDefinitionReader(AbstractBeanDefinitionReader).loadBeanDefinitions(String) line: 188	
	XmlBeanDefinitionReader(AbstractBeanDefinitionReader).loadBeanDefinitions(String...) line: 252	
	GenericXmlContextLoader(AbstractGenericContextLoader).loadBeanDefinitions(GenericApplicationContext, MergedContextConfiguration) line: 257	
	GenericXmlContextLoader(AbstractGenericContextLoader).loadContext(MergedContextConfiguration) line: 124	
	GenericXmlContextLoader(AbstractGenericContextLoader).loadContext(MergedContextConfiguration) line: 60	
	AbstractDelegatingSmartContextLoader.delegateLoading(SmartContextLoader, MergedContextConfiguration) line: 108	
	DelegatingSmartContextLoader(AbstractDelegatingSmartContextLoader).loadContext(MergedContextConfiguration) line: 251	
	DefaultCacheAwareContextLoaderDelegate.loadContextInternal(MergedContextConfiguration) line: 98	
	DefaultCacheAwareContextLoaderDelegate.loadContext(MergedContextConfiguration) line: 116	
	DefaultTestContext.getApplicationContext() line: 83	
	DependencyInjectionTestExecutionListener.injectDependencies(TestContext) line: 117	
	DependencyInjectionTestExecutionListener.prepareTestInstance(TestContext) line: 83	
	TestContextManager.prepareTestInstance(Object) line: 230	
	SpringJUnit4ClassRunner.createTest() line: 228	
	SpringJUnit4ClassRunner$1.runReflectiveCall() line: 287	
	SpringJUnit4ClassRunner$1(ReflectiveCallable).run() line: 12	
	SpringJUnit4ClassRunner.methodBlock(FrameworkMethod) line: 289	
	SpringJUnit4ClassRunner.runChild(FrameworkMethod, RunNotifier) line: 247	
	SpringJUnit4ClassRunner.runChild(Object, RunNotifier) line: 94	
	ParentRunner$3.run() line: 290	
	ParentRunner$1.schedule(Runnable) line: 71	
	SpringJUnit4ClassRunner(ParentRunner<T>).runChildren(RunNotifier) line: 288	
	ParentRunner<T>.access$000(ParentRunner, RunNotifier) line: 58	
	ParentRunner$2.evaluate() line: 268	
	RunBeforeTestClassCallbacks.evaluate() line: 61	
	RunAfterTestClassCallbacks.evaluate() line: 70	
	SpringJUnit4ClassRunner(ParentRunner<T>).run(RunNotifier) line: 363	
	SpringJUnit4ClassRunner.run(RunNotifier) line: 191	
	JUnit4TestReference.run(TestExecution) line: 89	
	TestExecution.run(ITestReference[]) line: 41	
	RemoteTestRunner.runTests(String[], String, TestExecution) line: 541	
	RemoteTestRunner.runTests(TestExecution) line: 763	
	RemoteTestRunner.run() line: 463	
	RemoteTestRunner.main(String[]) line: 209	

 

 

    static String getTransactionManagerName(Element element) {
        return (element.hasAttribute(TRANSACTION_MANAGER_ATTRIBUTE) ?
                element.getAttribute(TRANSACTION_MANAGER_ATTRIBUTE) : DEFAULT_TRANSACTION_MANAGER_BEAN_NAME);
    }

 

static final String TRANSACTION_MANAGER_ATTRIBUTE = "transaction-manager";

static final String DEFAULT_TRANSACTION_MANAGER_BEAN_NAME = "transactionManager";

 

posted on 2023-07-13 18:00  zno2  阅读(14)  评论(0编辑  收藏  举报

导航