slackapi / java-slack-sdk

Slack Developer Kit (including Bolt for Java) for any JVM language
https://slack.dev/java-slack-sdk/
MIT License
570 stars 209 forks source link

Add support for micronaut 4 #1252

Closed bjor-joh closed 5 months ago

bjor-joh commented 8 months ago

There is a todo to upgrade to micronaut 4.x. Any concrete plans for this?

I tried using the existing version with micronaut 4 a while back but it didn't work.

Category (place an x in each of the [ ])

seratch commented 8 months ago

Hi @bjor-joh, thanks for writing in. We will update the module to support Micronaut 4 in the future, but I cannot tell when the change will be released. The module is quite simple and it has only two source files. If you're in a hurry to use Micronaut 4, please fork the implementation and adjust it to work with v4.

hrothwell commented 5 months ago

@bjor-joh I am definitely late to the party here but just came across this issue now. You should be able to get things working using Micronaut's @Import (which they say only works in java but seems fine in kotlin for me, possibly they mean the whole jvm or documentation is just out of date)

example:

import io.micronaut.context.annotation.Import
import io.micronaut.runtime.Micronaut

// checks these packages for JSR-330 annotated classes to make beans
// can also just be specific classes, which i did in my own use case
@Import(packages = ["com.slack.api.bolt.micronaut"])
object Application {
  @JvmStatic
  fun main(args: Array<String>) {
    Micronaut.build()
      .packages("com.github.example")
      // ... other setup you might do 
      .mainClass(Application.javaClass)
      .start()
  }
}
seratch commented 5 months ago

Resolved by #1294 (thanks to @hrothwell!)