gpt-3.5-turbo-0301· OpenAI
WildChat-4.8M (AI2)
springframework的@Value注解,如何获取application.yaml中自定义的一个字符串数组
- User
springframework的@Value注解,如何获取application.yaml中自定义的一个字符串数组
- Assistant
使用@Value注解时,需要指定要获取的配置项的全名,形式为${property},其中property为application.yaml中的配置项名称。如果要获取一个字符串数组,需要使用{property}形式,例如:
@Value("${my.string.array}") private String[] myStringArray;其中,my.string.array为自定义的字符串数组配置项,在application.yaml中的形式可能如下:
my: string: array: ["value1", "value2", "value3"]使用@Value注解即可将该配置项的值注入到myStringArray中。
Other models, same or similar prompt
Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.