Kotlin with spring in trouble,Error:(18, 65) Kotlin: Expecting an element


#1

@kotlin hi, i’m use kotlin with anno and spring,now i have a problem.please see it in java code:

@ComponentScan(basePackages = "com.kis",excludeFilters = @ComponentScan.Filter({Controller.class, RestController.class,Configuration.class}))

when it convert to kotlin.it’s can’t work.like this

@ComponentScan(basePackages = "com.kis", excludeFilters = @ComponentScan.Filter({Controller.class, RestController.class,Configuration.class}))

i can change basePackages=arrayOf("com.kis.config") but about excludeFilters i have no way…

how can i do?
btw:what is the direction of kotlin for future? android or web(j2ee)


#2
excludeFilters = arrayOf(ComponentScan.Filter({Controller::class, RestController::class,Configuration::class})))

That should do it :slightly_smiling:


#3

no,it can’t work

thank you


#4

oh
thank you i get it


#5

must use like this

@ComponentScan(excludeFilters = arrayOf(ComponentScan.Filter(Controller::class),ComponentScan.Filter(RestController::class),ComponentScan.Filter(Configuration::class))
```