Registering Builders
Once the builders are created, you need to let Spring infrastructure know about it. Registration can be done either via explicit configuration or by automated scanning. Automated scanning is the preferred approach for typical use cases.
1. Automated scanning: You can configure to automatically pick up all builders within a certain package hierarchy. To do this, add the <mvc:builder-scan/> configuration element to <Windchill>\codebase\config\mvc\custom.xml.
<beans xmlns="xmlns:mvc="http://www.ptc.com/schema/mvc"
xsi:schemaLocation="http://www.ptc.com/schema/mvc
http://www.ptc.com/schema/mvc/mvc-10.0.xsd">
<mvc:builder-scan base-package="com.ptc.windchill.enterprise.
preference.mvc.builders"/>
</beans>
The builder-scan implementation scans the entire classpath, so you should take care to be specific with the package name you declare if using scanning. (don’t scan com.ptc.* for example). In addition, this means that classes that are outside your interest, but that are in the classpath and match the package hierarchy, will also get scanned. From a performance standpoint (MethodServer startup) each scan adds up time. You are requested to take advantage of the OOTB scan provided on “com.ptc.mvc.builders” base package. This means that all the builders that you author should be under com.ptc.mvc.builders package. If you are not using the OOTB scan, the rule of thumb is to use the scan if there are more than 10 builders available in the package.
2. Explicit configuration : To do this, simply add a bean declaration for the builder to <Windchill>\codebase\config\mvc\custom.xml
For example, <bean class=" my.builder.class.name "/>
You are encouraged not to specify the bean name while declaring the bean and use @ComponentBuilder annotation in the builder for proper registration of it in the Spring bean factory.
Было ли это полезно?