获取目前Spring容器中的bean

获取当前Spring容器中的beanWebApplicationContext applicationContext WebApplicationContextUtils.get

获取当前Spring容器中的bean

WebApplicationContext applicationContext = WebApplicationContextUtils.getWebApplicationContext(request.getSession().getServletContext());PersonService personService = (PersonService)applicationContext.getBean("personService");