Today, when the listener is configured, an error has been encountered: Javax.naming.NameNotFoundException:Name Com.xxx.xxx.xxxListener is isn't bound in the context,
4 hours later, I finally figured out why.
Because of the use of spring injection, it is used in the listener class that you define
@Resource
Private Iusermanage usermanage;
annotation, but spring's injection is after filter and listener, (in the Order of listener >> filter >> servlet > > Spring)
Therefore, it is not possible to use spring injection in the listener class, and you need to write such a piece of code:
Private Iusermanage usermanage;
Classpathxmlapplicationcontext ctx=new classpathxmlapplicationcontext ("Applicationcontext.xml");
Usermanage= (iusermanage) Ctx.getbean ("Usermanageimp");
This way you get an instance of the service layer, and the Web.xml configuration file remains the same.
Similarly, it is the same to speculate that you write the filter, but it is not validated, only for reference.