If you start a Spring Application with Kotlin code like so:
@SpringBootApplication
class Application
fun main(args: Array<String>) {
runApplication<Application>(*args)
}
Spring will not be able to detect @Controller classes written in Java like so:
@Controller
public class TestController {
@GetMapping("/test")
public String getTestPage(Model model) {
return "test";
}
}
If you run the application with an identical java version like:
@SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
Then it can pickup both java and kotlin controllers.
Project structure:
Comment From: wilkinsona
Please share a minimal example and describe exactly how you're building and running the application. We need to know how Maven or Gradle is configured to verify that the right plugins are in place. We also need to know how you're running the application as this affects how its classpath is created. This is particularly important if you're running it from IDEA and using Gradle as IDEA can be configure to delegate to Gradle or to run the application itself, both of which form the classpath differently.
Comment From: Fliperdo
Hey @wilkinsona, went to make the example project, and haven't been able to reproduce the issue on my personal project or within the example. Not sure what caused that behavior, sorry for the extra administrative work. Closing this ticket as not reproducible. Thanks
Comment From: wilkinsona
No problem. Thanks for letting us know.