How to get rid of this error{<Component-import> cannot be used when atlassian plugin key is set}?

I am following the below tutorial to implement plugin to run the background job, but it seems that the following tutorial is outdated because the error im getting is that i cannot use the and when the atlassian plugin Key is set. can you people assist me in accomplishing my task to achieve implementing the background job.

https://developer.atlassian.com/server/framework/atlassian-sdk/scheduling-events-via-sal-tutorial/

That tutorial is using the old <component-import and <component on things. Your project is more than likely using a project generated from the sdk which would be using spring-scanner. With Spring Scanner you’d annotate each class with @Component that you want use as a component and any imports - you’d do @ComponentImport in the class.

Now the bad news - PluginScheduler is deprecated. The replacement is the atlassian-scheduler. Take a look at How to use the Atlassian Scheduler