数据库配置读取

This commit is contained in:
myh 2023-10-06 23:33:18 +08:00
parent 37988c4ff0
commit 717c7bbc05
2 changed files with 4 additions and 13 deletions

View File

@ -5,10 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class SpringDemoApplication {
public static void main(String[] args) {
SpringApplication.run(SpringDemoApplication.class, args);
}
}

View File

@ -1,21 +1,15 @@
package com.example.springdemo.config;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.stereotype.Component;
@Data
@Component
@ConfigurationProperties(prefix = "business.security")
@ConfigurationProperties(prefix = "spring.datasource")
public class DataBaseProperties {
private String dbUrl;
//@Value("${db.username}")
private String url;
private String username;
//@Value("${db.password}")
private String password;
}