java - Scala and @Inject annotation -
i know best way deal dependency injection in scala using tools built language, working on project must integrate scala , java code.
then, using google guice, implements specification jsr-330. fortunatly, found no problem during integration of guice , scala. using constructor injection, because have deal immutability.
my question is, why in scala have use notation @inject()
in front of constructor parameter? why ()
paranthesis? follows example:
class myclass @inject() (val another: anotherclass) { // body of class }
otherwise, how tell if (val another: anotherclass)
constructor parameter list or arguments @inject
?
Comments
Post a Comment