GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Mindmap

Spring

Jorge Celis Spanisch

Spring

Inhalt der Mindmap

Spring

  1. configuration

    • pom
      • build tag to change compiler (java version)
        • maven-compiler-plugin
          • configuration
            • java version
      • add spring dependency
  2. xml configuration

    • application context
      • sort of Hash Map
      • can be a registry
      • multiple types of xml available
        • properties defined by its schema type
          • beans: allow us to defien multiple bean
      • namespaces
        • acts as a dictionary for the properties we can inject into a bean
      • need to create a context in the main method
  3. beans

    • are essentially classes
      • replace keyword new
    • injection
      • setter
        • define the properties inside the bean in java code
        • in xml, bind the property with its bean
        • name based
      • can mix both
      • constructor
        • index based
        • need to define constructor for each situation
        • modify xml and bean
    • autowire
      • 4 ways
        • by type
          • as by name, match the bean property with the bean declared in xml, using the class type.
        • by name
          • uses set method, and tries to match the bean declared inside xml with the "setName method" inside the bean using the name
        • constructor
        • no
    • 5 possible scope for beans
      • Singleton
        • creates a single instance of a bean for each container
          • use @Scope("singleton" or ConfigurableBeanFactory.SCOPE_SINGLETON)
      • prototype
        • guarantee an unique instance per bean request
      • webScopes
        • Request
          • creates a bean per http request
        • Session
          • creates a single bean per live session
        • globalSession
          • creates a single bean per application
  4. goals

    • separate configuration from logic (separation of concerns)
      • no need to recompile the whole project
  5. Dependency Injection types

    • Annotation configuration
      • aplicationContext.xml
        • uses the beans schema
        • includes a component scanner
        • includes namespaces context (non version to keep compatibily)
      • Stereotype annotations
        • @Component
          • any POJO (meant to be a bean)
        • @Service
          • bussiness logic layer
            • the 3 define the name bean in parentesis
        • @Repository
          • Data Acess tier
        • semantically they are the same (service and repository extends component and dont add any feature, it`s about how you think of them and use them)
        • allow us to mark POJOS as Beans
      • Autowire
        • Can autowire at 3 places
          • member variables
            • should be avoided, makes the testing harder
          • constructor
            • the 3 approches uses the @autowired before the definition
          • setter
    • java configuration
      • uses java instead of xml
        • called AppConfig and define the beans?
      • there is no need to have an applicationContext
        • uses java instead of xml
          • called AppConfig and define the beans inside
          • uses the class level annotation @Configuration and @Bean
      • injection
        • setter injection
          • need to define a setter inside the class where beans will be injected, which will be called in "AppConfig"
        • construction injection
          • works as setter injection, but need a constructor instead
      • Autowire
        • is available, need to add a @ComponentScan at the top of AppConfig
        • there is no need to define beans in AppConfig (can be empty except for the Scanner)
          • Must use @Autowired just above the setter
          • and use stereotype tag for @Service or @Repository when defining a class
  6. properties

    • abstact configuration and defined in one file
      • types
        • xml
          • need to
            • create a properties file
            • define its path in the application context.xml for the properties file
              • Define the property and its value inside the bean
            • create an attibute and its setter inside the bean
          • annotation
            • same steps just need to add @value in bean attibute, and annotation in application context
        • java config

Bilder und Dateien der Mindmap

  • Spring
  • Spring
  • Spring
  • Spring
  • Spring
  • Spring
  • Spring
  • Spring
  • Spring
  • Spring
  • Spring
  • Spring
  • Spring

Informationen

Beschreibung
Mindmap am Spring, erstellt von Jorge Celis am 01/10/2019.
Erstellt von
Jorge Celis
Aufrufe
0
Bewertung

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck