数据库配置读取
This commit is contained in:
parent
37988c4ff0
commit
717c7bbc05
@ -5,10 +5,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
|
|||||||
|
|
||||||
@SpringBootApplication
|
@SpringBootApplication
|
||||||
public class SpringDemoApplication {
|
public class SpringDemoApplication {
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
|
|
||||||
SpringApplication.run(SpringDemoApplication.class, args);
|
SpringApplication.run(SpringDemoApplication.class, args);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -1,21 +1,15 @@
|
|||||||
package com.example.springdemo.config;
|
package com.example.springdemo.config;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.boot.context.properties.ConfigurationProperties;
|
import org.springframework.boot.context.properties.ConfigurationProperties;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
@Component
|
@Component
|
||||||
@ConfigurationProperties(prefix = "business.security")
|
@ConfigurationProperties(prefix = "spring.datasource")
|
||||||
public class DataBaseProperties {
|
public class DataBaseProperties {
|
||||||
|
private String url;
|
||||||
private String dbUrl;
|
|
||||||
|
|
||||||
//@Value("${db.username}")
|
|
||||||
private String username;
|
private String username;
|
||||||
|
|
||||||
//@Value("${db.password}")
|
|
||||||
private String password;
|
private String password;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user