在@ComponentScan中使用多个路径不起作用 [英] Using multiple path in @ComponentScan is not working

查看:708
本文介绍了在@ComponentScan中使用多个路径不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在组件扫描中使用多路径时遇到问题.我从这里尝试了该解决方案如何使用@扫描多个路径ComponentScan批注?但它给我错误:

I'm having a problem using multiple path in component scan. I tried the solution from here How to scan multiple paths using the @ComponentScan annotation? but it gives me error:

@ComponentScan({"com.tx.loader", "com.tx.common"})
@SpringBootApplication

Unexpected tokens (Use ';' to separate expressions on the same line)

我正在使用Kotlin和Intellij IDE.

I'm using Kotlin and Intellij IDE.

推荐答案

这个解决了我的问题
将其放在main函数

This one solved my problem
Place it above the main function

@SpringBootApplication
@ComponentScan(basePackages = ["com.*"])
fun main(...) {...}

这篇关于在@ComponentScan中使用多个路径不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆