Skip to content

Spring Framework Blog

Menu
  • Home
  • Spring
  • Spring Boot
  • About
Menu

Author: Armando Marques

SpEL and Value

Posted on June 2, 2024June 18, 2024 by Armando Marques

Spring EL Accessing properties: $ – value# – expression/executionValue- @Value(“${bean.message}”)System environment variable- @Value(“#{systemEnvironment[‘SOME_ENV_VARIABLE’]}”) It casts to the required type: @Value(“${daily.limit}”) int maxTransferPerDay@Value(“#{environment[‘daily.limit’]}”)int maxTransferPerDay; But values are handled as String: @Value(“#{new Integer(environment[‘daily.limit’]) * 2 }”) -> OK@Value (“#{new java.net.URI(environment[‘home.page’]).host}”) -> OK@Value (“#{daily.limit * 2}”}) -> not OK Default values: @Value(“${daily.limit:1000}”)@Value(“#{environment[‘daily.limit’]?:1000}”) https://www.baeldung.com/spring-expression-language @Value This annotation can be…

SpringBoot Lifecycle extensions

Posted on June 1, 2024June 10, 2024 by Armando Marques

BeanFactoryPostProcessor BeanFactoryPostProcessor operates on bean configuration metadata, it reads the configuration metadata and can change it before the container instantiates the beans. This interfaces can be extended to provide further customization. BeanPostProcessor The BeanPostProcessor interface can be itself customized logic to default steps, when Spring container finishes instantiating, configuring, and initializing a bean, several implementations…

Autowiring and others

Posted on June 1, 2024June 7, 2024 by Armando Marques

Usage of @Autowired By default autowired beans are required but this be changed: @Autowired(required=false) Optional is also supported: Disambiguation @Qualifier is used for disambiguation, can be used both for components and beans (names). Autowiring resolution rules: Configuration choices If a class has only a default constructor -> no need to annotate with @Autowired if class had…

Stereotypes

Posted on June 1, 2024June 2, 2024 by Armando Marques

Stereotypes are part of Spring annotations config, used with @ComponentScan. Annotations: @Components – is a generic stereotype for any Spring managed components. @Service – annotates classes at the service layer, code that holds business layer. @Repository – annotation used for classes from the persistence layer. Catches specific exceptions and re-throws them as Spring unified unchecked…

Proxies

Posted on May 31, 2024June 18, 2024 by Armando Marques

Type of proxies available in Spring: JDK Proxy CGLib proxy also called dynamic proxiescomes with JDKonly for Interfacesall interfaces are proxies extra lib included in Springcan intercept protected and public methodsused when interfaces are not availablecannot be applied to final classes or methodsused by Spring Boot Key JDK dynamic proxy CGLIB proxy Basic It can…

Posts pagination

  • Previous
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • Next
  • Spring
  • Documentation
  • References
  • Toc
  • Books
  • Certification
  • AOP
  • Config
  • Java
  • Java core
  • JDBC
  • JPA
  • Rest
  • Security
  • Spring
  • Spring Boot
  • Spring Core
  • Spring Data
  • Spring MVC
  • Spring Rest
  • Spring Security
  • Tests
  • Transactions

Recent Posts

  • Java operators
  • Java versions
  • Java Oracle Licenses
  • Configuration properties
  • MockMvc
  • Spring Security III
  • MVC Controller Method Params
  • JPA Methods
  • Transaction propagation and isolation
  • Spring JDBC
  • Spring Boot Auto-Configuration
  • Spring Resource interface
  • JSR 330 Standard Annotations
  • Spring Aware Interfaces
  • Spring Transactions
  • Spring Boot Core
  • MVC Rest
  • Spring Boot JPA
  • Tests
  • Spring Actuator
©2025 Spring Framework Blog | Built using WordPress and Responsive Blogily theme by Superb