on 2015 Oct 15 10:10 AM
I defined a custom CockpitThreadContextCreator in mybackoffice-backoffice-spring.xml to add some additional session attributes to a newly created context:
<alias name="myThreadContextCreator" alias="cockpitThreadContextCreator"/>
<bean id="myThreadContextCreator" parent="backofficeCockpitThreadContextCreator" class="com.mybackoffice.MyThreadContextCreator">
</bean>
The bean gets instantiated successfully but is never used at runtime. Instead the default backofficeCockpitThreadContextCreator is used. How can i override the default implementation?
Request clarification before answering.
I've experienced the same problem, and indeed there does not seem to be an OOTB Hybris solution to adapt the logic of the backoffice-web defined beans. I've seen the solution of , but there is quite some modifications to the buildcallbacks, moving files around, so I've implement a different (and easier?) strategy. What I've done:
I've created a custom web spring xml file in the custom backoffice extension: mybackoffice/resources/mybackoffice-web-spring.xml
In this file, I override/change/... beans defined in the backoffice extensions web-spring xml
The trick that I've applied is to update the buildcallbacks.xml to include this custom web context in the web-app-context of the backoffice application (this means including the custom web xml file in the contextConfigLocation list)
Compile and run
The modifications to the buildcallbacks.xml are the following:
<macrodef name="mybackoffice_after_build">
<sequential>
...
<replaceregexp
file="${ext.backoffice.path}/web/webroot/WEB-INF/web.xml"
match="backoffice-web-spring.xml(?!,)"
replace="backoffice-web-spring.xml,classpath:mybackoffice-web-spring.xml"/>
</sequential>
</macrodef>
The result of those modifications can be seen in the backoffice extensions web.xml file:
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
WEB-INF/backoffice-web-spring.xml,classpath:mybackoffice-web-spring.xml
</param-value>
</context-param>
For me those adaptions work, and seem to be quite easy to achieve what I need.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
7 | |
2 | |
2 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 | |
1 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.