使用 @Component 、@ConfigurationProperties 注解。 application.properties: girl.name=lucy girl.age=25 或 application.yml : girl: name: lucy age: 25