I hereby claim:
- I am codingkapoor on github.
- I am codingkapoor (https://keybase.io/codingkapoor) on keybase.
- I have a public key ASAIu7upmPE-iMZKalV1vCG7Yd5q19rqwCcrYCxCnFlqfgo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
libraryDependencies += "org.scala-lang" % "scala-compiler" % "2.12.8" | |
libraryDependencies += compilerPlugin("org.scalamacros" % "paradise" % "2.1.0" cross CrossVersion.full) |
@EnableServiceDiscovery | |
object MyService extends App {} |
@compileTimeOnly("enable macro paradise to expand macro annotations") | |
class EnableServiceDiscovery extends StaticAnnotation { | |
def macroTransform(annottees: Any*): Any = macro EnableServiceDiscovery.impl | |
} | |
object EnableServiceDiscovery { | |
def impl(c: blackbox.Context)(annottees: c.Expr[Any]*): c.Expr[Any] = { | |
import c.universe._ | |
val result = { |
@EnableServiceDiscovery | |
object MyService extends App { | |
implicit val system = ActorSystem("myservice-actor-system") | |
implicit val materializer = ActorMaterializer() | |
implicit val executionContext: ExecutionContext = system.dispatcher | |
val interface = RuntimeEnvironment.appConfig.getString("myservice.http.interface") | |
val port = RuntimeEnvironment.appConfig.getString("myservice.http.port").toInt |
$ git clone [email protected]:codingkapoor/consul-scala-macro-annotations.git |
$ cd consul-scala-macro-annotations | |
$ sbt> project myservice | |
$ sbt> universal:packageBin |
$ cd consul-scala-macro-annotations/myservice/target/universal | |
$ unzip myservice-0.1.0-SNAPSHOT.zip | |
$ cd myservice-0.1.0-SNAPSHOT | |
$ bin/start.sh | |
$ tail -f logs/stdout.log |