java - Is it possible to change a class by hooking into bean definitions? -
i change 3rd party class in web-application using javassist. class gets loaded when spring web application context intialization gets called org.springframework.web.context.contextloaderlistener
. tried custom beanfactorypostprocessor
seems kick in late:
javassist.cannotcompileexception: java.lang.linkageerror: loader ... duplicate class definition name: "someclass"
i guess can done replacing contextloaderlistener
custom 1 changing class right before initializing beans. if somehow possible, prefer not touching web.xml @ all.
hence, question whether there way registering callback executes before classes of bean definitions load.
you might try implementing priorityordered
on beanfactorypostprocessor
achieve effect similiar propertyplaceholderconfigurer
invoked before other beans (so can load , make available, properties can use in bean definitions.
have @ propertyplaceholderconfigurer
pattern reuse.
Comments
Post a Comment