Posts

Showing posts with the label Spring

Spring Cert Notes

Dependency Injection In Spring DI Basics • Reduces coupling between classes • Classes do not obtain their dependencies (collaborators), Spring container provides proper dependency based on configuration provided • Enables easy switching of dependencies based en current needs - local development vs production environment, easy mocking for unit tests, in memory database vs production one, etc. • Promotes programming to interfaces • Spring-managed objects are called "beans" • Beans are written as POJOs, no need to inherit Spring base classes or implement spring interfaces • Classes can be completely independent of Spring framework (although for convenience Spring annotations are often used) • Lifecycle of beans is managed centrally by Spring container (eg. enforces singleton state of bean/ one instance pers session. one instance per HTTP request/...) • Spring configuration (including DI) is possible either via XML or Java configuration files (newer, more popular approac...