#Jarkata CDI to Spring DI

1 messages · Page 1 of 1 (latest)

keen orbit
#

Hi I am new to Spring DI and I have no idea what this class would look like in Spring. Can anyone translate this for me somehow? I got no good results with google.

@ApplicationScoped
class JavacordProducer {
    @Inject
    Logger logger;

    @Produces
    @ApplicationScoped
    DiscordApi produceDiscordApi() {
        return new DiscordApiBuilder()
                .setToken(discordToken)
                .login()
                .exceptionally(ExceptionLogger.get())
                .join();
    }

    private void disposeDiscordApi(@Disposes DiscordApi discordApi) {
        discordApi.disconnect();
    }
}```
pastel stumpBOT
#

<@&1004656351647117403> please have a look, thanks.

pastel stumpBOT
#

While you are waiting for getting help, here are some tips to improve your experience:

Code is much easier to read if posted with syntax highlighting and proper formatting.

If nobody is calling back, that usually means that your question was not well asked and hence nobody feels confident enough answering. Try to use your time to elaborate, provide details, context, more code, examples and maybe some screenshots. With enough info, someone knows the answer for sure.

Don't forget to close your thread using the command </help-thread close:1027500463647621170> when your question has been answered, thanks.

keen orbit
#

I just need the replacement for the annotations