一、编写Springboot
Springboot生产环境部署,外部配置文件
二、开启配置文件

package com.citydo.properties;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.context.properties.EnableConfigurationProperties;


@EnableConfigurationProperties
@SpringBootApplication
public class PropertiesApplication {

    public static void main(String[] args) {
        SpringApplication.run(PropertiesApplication.class, args);
    }
}

测试层

package com.citydo.properties;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping(value = "/test")
public class TestController {

    @Value("${asr.name}")
    private  String name;

    @RequestMapping(value = "/test")
    public  String test(){
       return name;
    }
}

三、Springboot打包在liunx生产服务器部署运行命令

nohup java -jar properties.jar --spring.config.location=../config/application.properties >error.log 2>&1 &

或者

java -jar properties.jar --spring.config.location=../config/application.properties >error.log 2>&1 &

生产服务器目录config放配置文件Springboot生产环境部署,外部配置文件
接下来开始spring cloud一些总结,待续…

相关文章:

  • 2021-12-06
  • 2021-05-15
  • 2021-08-02
  • 2021-07-23
  • 2021-10-17
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2021-12-01
  • 2022-12-23
  • 2021-10-07
  • 2021-09-07
  • 2021-04-20
相关资源
相似解决方案