AnnotationConfigEmbeddedWebApplicationContext.puml 4.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. @startuml
  2. class AnnotationConfigEmbeddedWebApplicationContext extends EmbeddedWebApplicationContext{
  3. public AnnotationConfigEmbeddedWebApplicationContext();
  4. protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory);
  5. public final void scan(String... basePackages) ;
  6. public void setScopeMetadataResolver(ScopeMetadataResolver scopeMetadataResolver);
  7. }
  8. class EmbeddedWebApplicationContext extends GenericWebApplicationContext{
  9. protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory);
  10. public final void refresh();
  11. protected void onRefresh();
  12. protected void finishRefresh();
  13. private void createEmbeddedServletContainer();
  14. protected EmbeddedServletContainerFactory getEmbeddedServletContainerFactory();
  15. }
  16. class GenericWebApplicationContext extends GenericApplicationContext implements ConfigurableWebApplicationContext, ThemeSource{
  17. public void setServletContext(ServletContext servletContext);
  18. public ServletContext getServletContext();
  19. protected ConfigurableEnvironment createEnvironment();
  20. protected void postProcessBeanFactory(ConfigurableListableBeanFactory beanFactory);
  21. protected Resource getResourceByPath(String path);
  22. protected void onRefresh();
  23. public String[] getConfigLocations();
  24. }
  25. class GenericApplicationContext extends AbstractApplicationContext implements BeanDefinitionRegistry{
  26. public Resource getResource(String location);
  27. public final ConfigurableListableBeanFactory getBeanFactory();
  28. }
  29. class AbstractApplicationContext extends DefaultResourceLoader implements ConfigurableApplicationContext, DisposableBean{
  30. public void publishEvent(ApplicationEvent event);
  31. public void addBeanFactoryPostProcessor(BeanFactoryPostProcessor postProcessor);
  32. public void addApplicationListener(ApplicationListener<?> listener);
  33. public void refresh() ;
  34. }
  35. class DefaultResourceLoader implements ResourceLoader{
  36. public Resource getResource(String location) ;
  37. protected Resource getResourceByPath(String path);
  38. }
  39. interface ConfigurableWebApplicationContext extends ConfigurableApplicationContext,WebApplicationContext{
  40. void setServletContext(ServletContext servletContext);
  41. void setServletConfig(ServletConfig servletConfig);
  42. void setConfigLocation(String configLocation);
  43. String[] getConfigLocations();
  44. }
  45. interface ApplicationContext extends HierarchicalBeanFactory,MessageSource,ApplicationEventPublisher,ResourcePatternResolver{
  46. String getId();
  47. String getApplicationName();
  48. String getDisplayName();
  49. long getStartupDate();
  50. ApplicationContext getParent();
  51. AutowireCapableBeanFactory getAutowireCapableBeanFactory() throws IllegalStateException;
  52. }
  53. interface ConfigurableApplicationContext{
  54. }
  55. interface Lifecycle{
  56. }
  57. interface Closeable{
  58. public void close() throws IOException;
  59. }
  60. interface EnvironmentCapable{
  61. Environment getEnvironment();
  62. }
  63. interface ListableBeanFactory extends BeanFactory{
  64. String[] getBeanNamesForType(ResolvableType type);
  65. }
  66. interface BeanFactory{
  67. Object getBean(String name) throws BeansException;
  68. <T> T getBean(String name, Class<T> requiredType) throws BeansException;
  69. <T> T getBean(Class<T> requiredType) throws BeansException;
  70. }
  71. interface HierarchicalBeanFactory extends BeanFactory{
  72. BeanFactory getParentBeanFactory();
  73. }
  74. interface MessageSource{
  75. String getMessage(String code, Object[] args, String defaultMessage, Locale locale);
  76. }
  77. interface ApplicationEventPublisher{
  78. void publishEvent(ApplicationEvent event);
  79. }
  80. interface ResourcePatternResolver extends ResourceLoader{
  81. Resource[] getResources(String locationPattern) throws IOException;
  82. }
  83. interface ResourceLoader{
  84. Resource getResource(String location);
  85. ClassLoader getClassLoader();
  86. }
  87. ApplicationContext <|-- ConfigurableApplicationContext : 继承关系
  88. Lifecycle <|-- ConfigurableApplicationContext : 继承关系
  89. Closeable <|-- ConfigurableApplicationContext : 继承关系
  90. EnvironmentCapable <|-- ApplicationContext:继承关系
  91. ListableBeanFactory <|-- ApplicationContext:继承关系
  92. @enduml