Search
 
SCRIPT & CODE EXAMPLE
 

JAVA

spring db properties

spring:
    profiles: local
    datasource:
        url: jdbc:postgresql://localhost:5432/postgres
        username: postgres
        password: root
Comment

spring db properties


@Configuration   
public class ConfigurationPropertySource {

private ConfigurableEnvironment env;

private final ConfigurationRepository configurationRepository;

    @Autowired
    public ConfigurationPropertySource(ConfigurationRepository configurationRepository) {
        this.configurationRepository = configurationRepository;
    }

    @Autowired
    public void setConfigurableEnvironment(ConfigurableEnvironment env) {

        this.env = env;
   }

   @PostConstruct
   public void init() {
    MutablePropertySources propertySources = env.getPropertySources();
       Map myMap = new HashMap();
       //from configurationRepository get values and fill mapp
       propertySources.addFirst(new MapPropertySource("MY_MAP", myMap));
   }

}

Comment

PREVIOUS NEXT
Code Example
Java :: java get number of months between two dates 
Java :: java.lang.object[4] 
Java :: java protected private public 
Java :: start async task android 
Java :: execute exe java 
Java :: math.absolute java 
Java :: variables java 
Java :: how to reverse a string in java without function 
Java :: how to set boolean to false if null java 
Java :: linear search java 
Java :: Could not determine java version from 
Java :: how to round double to 2 decimal places java 
Java :: I/flutter (10109): {filePath: null, errorMessage: java.io.FileNotFoundException: open failed: EACCES (Permission denied), isSuccess: false} 
Java :: quicksort for arraylist 
Java :: java throw an exception 
Java :: hide steam games from friends 
Java :: distance point to line java 
Java :: Add month to date in java 8 
Java :: calculate number of years months and days between two dates in java 
Java :: how to multiply bigdecimals 
Java :: java map merge example 
Java :: java search string in string 
Java :: import java.lang.Math.*; 
Java :: java print 2d array as table 
Java :: how to get request json web token in next js 
Java :: how to set context path in spring boot 
Java :: convert arraylist to array int 
Java :: java string vs stringbuilder 
Java :: if else statement 
Java :: array find max in java 
ADD CONTENT
Topic
Content
Source link
Name
7+7 =