dimanche 5 avril 2015

Storing XML location in declared bean's field

Is it possible (and how) to track back location in XML file where the beans are declared?


I want to store this information in bean's field, for example, spring/forms/login-form.xml:30:20.


Is there easier way to do this than declaring new namespace and using NamespaceHandler?


Example I have class MyBean...



pubic class MyBean implements SourceLocationAware {
private String locationString;

@Override
public void setLocationString(String locationString){
this.locationString = locationString;
}

@Override
public String getLocationString(){
return this.locationString;
}

/* some other delcarations */
}


... instance of which I want to declare in xml app context path/to/context/my-context.xml:



<bean id="myBean" class="k.p.MyBean">
<!-- declarations -->
</bean>


Given those, I want myBean instance to have locationString be set as, for example, path/to/context/my-context.xml:32:4


Aucun commentaire:

Enregistrer un commentaire