数据库配置读取
This commit is contained in:
		@@ -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);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -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 username ;
 | 
			
		||||
 | 
			
		||||
    //@Value("${db.password}")
 | 
			
		||||
    private String password ;
 | 
			
		||||
    private String url;
 | 
			
		||||
    private String username;
 | 
			
		||||
    private String password;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user