You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@dubbo.apache.org by YL Mei <my...@gmail.com> on 2020/12/03 08:34:56 UTC
Export dubbo services in play framework for scala
We use Play Framework 2.7 for scala develop our backend project, we need export some dubbo service, like this:
<code>
class UserService @Inject()(
userDao: UserDao
) extends NJUserService {
def updateUserProfile(uid: String, avatar: String) = {
userDao.updateAvatar(uid, avatar).map { result =>
...
}
}
}
</code>
but dubbo using reflect to create UserService instance, so that can not handle @Inject correctly.
I exported dubbo service ref https://dubbo.apache.org/docs/v2.7/user/quick-start/#service-provider It seem play using Google Guice to realize injection, but it not support by dubbo, any one have a good solution, I am very appreciative.
when play framework run, the exception like:
Error injecting constructor, org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'UserService' defined in class path resource [dubbo-provider.xml]: Instantiation of bean failed;