Property Sources in Spring Application vary based on the type of applications that is being executed:
Environment Abstraction is part of the Spring Container that models two key aspects of the application environment:
Spring Expression Language (SpEL) is an expression language that allows you to query and manipulate objects graphs during the runtime. SpEL is used in different products across the Spring portfolio.
@Value is used for:
To inject scalar/literal values into Spring Beans, you need to use @Value annotation. @Value annotation has only one field value.
Spring Framework does not specify any explicit limit on the number of profiles. However, since some of the classes in Framework are using an array to iterate over profiles.
Yes, @Profile annotation can be used together with @Component on top of the class representing spring bean.
Yes, @Bean annotation can be used together with @Profile inside class annotated with @Configuration annotation on top of the method that returns an instance of the bean.
Spring Profiles are configured by:
A class annotated with @Configuration cannot be final because Spring will use CGLIB to create a proxy for @Configuration class. CGLIB creates subclass for each class that is supposed to be proxied, however since the final class cannot have subclass CGLIB will fail. This is also a reason why methods cannot be final, Spring needs to override methods from parent class for the proxy to work correctly, however, final method cannot be overridden, having such a method will make CGLIB fail.