问题描述
我正在尝试开发一个带有函数和谷歌云的 spring 云应用程序。现在我可以使用 mvn function:run 启动 webservice 就像示例建议的那样。但是我遇到了以下错误
Failed to execute org.springframework.cloud.function.adapter.gcp.GcfJarLauncher
java.lang.IllegalArgumentException: 'function' with name '' must not be null
这是我的课
@Component
open class UserFunctions: supplier<UserDto?>,Consumer<UserDto> {
@Autowired
lateinit var userService: UserService
override fun get(): UserDto? {
val context = SecurityContextHolder.getContext()
return userService.getUserByEmail(context.authentication.name)
}
override fun accept(userDto: UserDto) {
userService.saveUser(userDto,SecurityContextHolder.getContext().authentication.name)
}
}
这是我的配置
spring:
config:
name: local
....
cloud:
function:
web:
path: /api/v1/
deFinition: userfunctions
gcp:
firestore:
emulator:
enabled: false
enabled: false
我试过没有路径,调用定义 UserFunction userFunctions 并调用 HTTP://localhost:8080:/ /api/v1/ api/v1/userFunctions 等...
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)