Return to site

🍃🎓 SPRING CERTIFICATION QUESTION: Which are valid ways to load external properties in Spring?

· vcp,java,spring

Which are valid ways to load external properties in Spring?

Using @PropertySource annotation

Using @Property annotation

Using @Value annotation

Using @Env annotation

Answer:

✅ You can load external properties with @PropertySource .

Ex:

✅ You can also load external properties with @Value .

Ex:

❌ There is no such @Env annotation but usually, you load the environment with @Autowired:

❌ Property is not an annotation, it is a class used to handle beans properties:

#spring #certificationquestion #vcp