English 中文(简体)
你们怎么会把会议规模的灯塔混为一谈,以便能够从请求和其他服务处获取信息?
原标题:How do you configure a Session-Scoped bean to be able to access information from the request and from other services?

为了让本届会议的镜子发挥作用,它需要使用<代码>Request的标语,以使其能够确定挂号用户的特权。

它还需要能够进入<代码>用户服务——另一个信标。

获取这些资源需要什么?

@Configuration
public class ExceptionResolverBuilder 
{
    @Bean @Scope(value = WebApplicationContext.SCOPE_SESSION, proxyMode = ScopedProxyMode.TARGET_CLASS)
    public ExceptionResolver getExceptionResolver() 
    {

        ExceptionResolver er = new ExceptionResolver();

        User user = userService.getLoggedInUser(request);

        if(user.isAdmin())
        {
            sendEmail("Caught exception:" + exeption.getMessage());
        }
        else
        {
            writeLog("Caught exception:" + exeption.getMessage());              
        }

        return er;
    }

}
问题回答

简言之,届会范围大的豆无法轻易获得启动会议的要求。

However, in your case you shouldn t need to. Assuming that your ExceptionResolver is an implementation of HandlerExceptionResolver, then there s no reason to put your logging logic into ExceptionResolverBuilder.getExceptionResolver(), since the resolver will get passed the current HttpServletRequest in the resolveException method.

还考虑使用<代码>@ExceptionResolver annotation,使生活更加容易,并且还考虑使用

为了让本届会议的镜子工作,它需要查阅请求的标语,以使其能够确定挂牌用户的特权。

AFAIK,只有在作为参数通过时,或通过当地人,才能获得目前的请求。

如果你使用春天安全,你通过打电话<条码>,获取当前申请的认证信息。 (通常使用一对地。) 然而,我不相信这样做会奏效,因为在确定安全背景时,你的方法可能会被称作。

It also needs to be able to access the userService - another bean.

你们需要作出安排,通过依赖注射提供这种服务。





相关问题
Spring Properties File

Hi have this j2ee web application developed using spring framework. I have a problem with rendering mnessages in nihongo characters from the properties file. I tried converting the file to ascii using ...

Logging a global ID in multiple components

I have a system which contains multiple applications connected together using JMS and Spring Integration. Messages get sent along a chain of applications. [App A] -> [App B] -> [App C] We set a ...

Java Library Size

If I m given two Java Libraries in Jar format, 1 having no bells and whistles, and the other having lots of them that will mostly go unused.... my question is: How will the larger, mostly unused ...

How to get the Array Class for a given Class in Java?

I have a Class variable that holds a certain type and I need to get a variable that holds the corresponding array class. The best I could come up with is this: Class arrayOfFooClass = java.lang....

SQLite , Derby vs file system

I m working on a Java desktop application that reads and writes from/to different files. I think a better solution would be to replace the file system by a SQLite database. How hard is it to migrate ...

热门标签