How to bridge Spring Application Context events to an other context

前端 未结 5 862
深忆病人
深忆病人 2021-01-07 22:58

I have a Spring web application with two contexts: one (applicationContext) built by ContextLoaderListener and a second (webContext) b

5条回答
  •  不知归路
    2021-01-07 23:35

    Try moving the event publisher to the web context file, where it should have visibility over the whole application context. A similar issue occurs when configuring method security in the parent application context. The parent application context (loaded by ContextLoaderListener) isn't aware of the child (web) context.

    You can also use a single application context for the entire application if you don't really need the parent-child relationship between the two. Often it just gets in the way and it is easier if all beans were defined in the same space.

提交回复
热议问题