@propertysource
时间: 2023-09-13 07:08:29 浏览: 43
@propertysource is a Spring Framework annotation that is used to specify the name of a properties file that contains the configuration properties for a Spring application. This annotation is used in conjunction with the @Configuration annotation to define a configuration class that can be used to configure Spring beans.
For example, if you have a properties file named "application.properties" that contains configuration properties for your Spring application, you can use the @PropertySource annotation to specify the name of this file:
```
@Configuration
@PropertySource("classpath:application.properties")
public class AppConfig {
// Configuration code here
}
```
This will tell Spring to load the properties file from the classpath and use the properties defined in it to configure the application. You can specify multiple @PropertySource annotations in a configuration class to load properties from multiple files.