/** * Determine the password to use based on this configuration and the environment. * * @return the password to use * @since 1.4.0 */ public String determinePassword() { if (StringUtils.hasText(this.password)) { return this.password; } if (EmbeddedDatabaseConnection.isEmbedded(determineDriverClassName())) { return ""; } return null; }
/** * Determine the username to use based on this configuration and the environment. * * @return the username to use * @since 1.4.0 */ public String determineUsername() { if (StringUtils.hasText(this.username)) { return this.username; } if (EmbeddedDatabaseConnection.isEmbedded(determineDriverClassName())) { return "sa"; } return null; }
@Override public ConditionOutcome getMatchOutcome( ConditionContext context, AnnotatedTypeMetadata metadata) { if (anyMatches(context, metadata, this.nonEmbedded)) { return ConditionOutcome.noMatch("existing non-embedded database detected"); } EmbeddedDatabaseType type = EmbeddedDatabaseConnection.get(context.getClassLoader()).getType(); if (type == null) { return ConditionOutcome.noMatch("no embedded database detected"); } return ConditionOutcome.match("embedded database " + type + " detected"); }
@Override public void afterPropertiesSet() throws Exception { this.embeddedDatabaseConnection = EmbeddedDatabaseConnection.get(this.classLoader); }