aurmam wrote:
it does not heled for me
Do you mean that you absolutely must access the applicationContext in
the Page constructor?
Because you might want to look at the following which works by
injecting the applicationContext after the Page is created:
public class HomePage extends BorderPage {
private Logger logger = getLogger(getClass());
// Constructor does not depend on applicationContext
// anymore so setter injection will work
public HomePage() {
}
// ApplicationContext can be used in onSecurityCheck
public boolean onSecurityCheck() {
if (hasPermission(Permission.LOGIN)) {
logger.error("has permision :" + getUserName());
}
}
// ApplicationContext can be used in onInit
public void onInit() {
logger.error("Logged in as :" + getUserName());
logger.error("Text from interface "
+ getDatabaseFunctions().getText(getUserName()));
getModel().put("title", getUserName());
}
}
i added context assignedment to getBean
and now it works but is it logicaly good i don't know
This approach looks problematic because every request a new Page is
created, thus you will reinitialize the applicationContext all the time.
Rather use a singleton or ThreadLocal/Filter combo. Here are some ways
to do this:
http://stackoverflow.com/questions/129207/getting-spring-application-context
kind regards
bob