Spring Framework
Spring Bean support in PreEmptive Protection™ DashO™ for Android & Java is provided primarily by the Spring Bean special class.
It is configured with the class name (or name pattern) and optional entry points (e.g. init, destroy, and factory methods).
During processing, the property methods (get*()
, is*()
, and set*(*)
), public constructors, and configured entry points, will be followed to determine unused methods.
The class, configured entry points, property methods and non-property methods can be configured to be renamed.
DashO will scan the Spring XML files during each build and will update any class references in the XML if DashO has renamed the corresponding Java class. It will update direct class references as well as class names listed in parameters or argument types. It will also update bean property names and entry point method names if DashO renamed them. Abstract beans (e.g. bean definitions without classes) will also have related property names and method names updated as it is assumed they are related to the renamed beans.
To get the most benefit out of DashO's Spring support, we suggest starting your project by using the New Project Wizard, and then making individual adjustments to the special classes as needed.
The New Project Wizard will identify Spring XML files, scan them for bean class references and configure Spring Bean special classes. When the New Project Wizard finds a bean definition in a Spring XML file, it:
Creates a new Spring Bean special class for the identified
class
.Looks for configured
init-method
ordestroy-method
attributes in the XML and adds them to the special class as entry points. If noinit-method
ordestroy-method
attribute was found, it will check fordefault-init-method
ordefault-destroy-method
attributes, respectively, and instead adds them to the special class as entry points.Looks for a configured
factory-method
directly on the bean and adds it to the special class as an entry point.Looks for configured
lookup-method
orreplaced-method
elements and adds them to the special class as entry points.Looks for constant values referenced using
util:constant static-field
or theorg.springframework.beans.factory.config.FieldRetrievingFactoryBean
bean.
Please take a look at the SpringBean sample project as it provides examples of DashO's support.
Note: If you use the
factory-bean
attribute, you will need to manually add the correspondingfactory-method
as an entry point on the appropriate class.
If you usereplaced-method
functionality, you may need to specify the signature using thearg-type
elements so the correct method will be identified after renaming.
If you use theFieldRetrievingFactoryBean
thetargetObject
attribute is not supported.