2022-06-21

2022-06-21  本文已影响0人  木麻黄

```

package com.hengan.springboottest.controller;

import org.springframework.beans.factory.annotation.Value;

import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

@RestController

public class HelloController {

    //读取配置文件

    @Value("${user.uname}")

    private String uname;

    @RequestMapping("/method1")

    public String getProp(){

        return "读取配置文件的第一种方式:通过Value注解      "+uname;

    }

}

```

上一篇 下一篇

猜你喜欢

热点阅读