Create a gist now

Instantly share code, notes, and snippets.

What would you like to do?
A mysql example using @Protocol
import javax.inject.Inject;
import io.fabric8.annotations.Protocol;
import io.fabric8.annotations.ServiceName;
public class MysqlExampleWithProtocol {
private static final DB = "mydb";
private final Connection connection;
public MysqlExampleWithProtocol(@Inject @Protocol("jdbc:mysql") @ServiceName("mysql") String serivceUrl) {
Class.forName("com.mysql.jdbc.Driver");
return DriverManager.getConnection(serivceUrl + "/" + DB);
}
//More stuff
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment