beginnerSpring Core Annotations

What do @PropertySource and @PropertySources do in Spring?

@PropertySource explicitly registers an additional .properties file (beyond the default application.properties) into Spring's Environment, so its keys become available for @Value injection or @ConfigurationProperties binding — e.g. @PropertySource("classpath:custom.properties"). @PropertySources is the container annotation that lets you specify multiple @PropertySource entries together on a single @Configuration class.

This is a Pro question

Sign in, then upgrade to Pro or Power to unlock this question and the full Interview Prep bank.

What do @PropertySource and @PropertySources do in Spring?

Next Step

Continue to What are transaction propagation types? Explain REQUIRED, REQUIRES_NEW, NESTED.← Back to all Spring Boot & Microservices questions