springMvc 如何通过注解@Value 读取配置文件中的内容(.properties)

时间:2025-02-13 11:15:28

一: 在controller 定义属性 

    @Value("${adminPath}")

    public String adminPath;

二:在.properties 文件配置:

adminPath=/yykj

三:在spring 的配置文件添加:

    <util:properties location="classpath:" local-override="true"/>