Just a heads up: On March 24, 2025, starting at 4:30pm CDT / 19:30 UTC, the site will be undergoing scheduled maintenance for a few hours. During this time, the site might be unavailable for a short while. Thanks for your patience.
×//Interface
public interface CronService
{
public void reschedule();
}
// class
@ExportAsService
@Component
@Named("CronServiceImpl")
public class CronServiceImpl implements CronService,LifecycleAware
{
static final String KEY = CronServiceImpl.class.getName() + ":instance";
private static final String JOB_NAME = CronServiceImpl.class.getName() + ":job";
@ComponentImport
private final PluginScheduler pluginScheduler;
@ComponentImport
protected final CustomFieldManager customFieldManager;
@ComponentImport
protected final FieldScreenManager fieldScreenManager;
private static final Logger log = LoggerFactory.getLogger(CronServiceImpl.class);
@Inject
public CronServiceImpl(final PluginScheduler pluginScheduler,final CustomFieldManager customFieldManager,final FieldScreenManager fieldScreenManager)
{
this.pluginScheduler = pluginScheduler;
this.customFieldManager = customFieldManager;
this.fieldScreenManager = fieldScreenManager;
}
public void reschedule()
{
// implementation
}
}
//Servlet
@Scanned
public class AdminServlet extends javax.servlet.http.HttpServlet
{
private static final Logger log;
@ComponentImport
private final UserManager userManager;
@ComponentImport
private final LoginUriProvider loginUriProvider;
@ComponentImport
private final TemplateRenderer templateRenderer;
@ComponentImport
private final PluginSettingsFactory pluginSettingsFactory;
private CronService cronService;
static
{
log = LoggerFactory.getLogger(AdminServlet.class);
}
@Inject
public AdminServlet(UserManager userManager, LoginUriProvider loginUriProvider,TemplateRenderer templateRenderer, PluginSettingsFactory pluginSettingsFactory,CronService cronService)
{
super();
this.userManager = userManager;
this.loginUriProvider = loginUriProvider;
this.templateRenderer = templateRenderer;
this.pluginSettingsFactory = pluginSettingsFactory;
this.cronService=cronService;
}
@Override
public void doGet(HttpServletRequest req, HttpServletResponse response) throws IOException, ServletException
{
}
@Override
public void doPost(HttpServletRequest req, HttpServletResponse response) throws IOException, ServletException
{
try
{
cronService.reschedule();
}
catch(Exception e)
{
//
}
}
}
//error
[INFO] [talledLocalContainer] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:334)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1210)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:537)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:476)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:342)
[INFO] [talledLocalContainer] ... 1 filtered
[INFO] [talledLocalContainer] at java.lang.reflect.Method.invoke(Method.java:498)
[INFO] [talledLocalContainer] at com.atlassian.plugin.osgi.spring.DefaultSpringContainerAccessor.createBean(DefaultSpringContainerAccessor.java:97)
[INFO] [talledLocalContainer] at com.atlassian.plugin.module.ClassPrefixModuleFactory.createModule(ClassPrefixModuleFactory.java:35)
[INFO] [talledLocalContainer] at com.atlassian.plugin.module.PrefixDelegatingModuleFactory.createModule(PrefixDelegatingModuleFactory.java:88)
[INFO] [talledLocalContainer] at com.atlassian.plugin.servlet.descriptors.ServletModuleDescriptor.getModule(ServletModuleDescriptor.java:43)
[INFO] [talledLocalContainer] at com.atlassian.plugin.servlet.DelegatingPluginServlet.<init>(DelegatingPluginServlet.java:30)
[INFO] [talledLocalContainer] at com.atlassian.plugin.servlet.DefaultServletModuleManager$LazyLoadedServletReference.create(DefaultServletModuleManager.java:472)
[INFO] [talledLocalContainer] at com.atlassian.plugin.servlet.DefaultServletModuleManager$LazyLoadedServletReference.create(DefaultServletModuleManager.java:456)
[INFO] [talledLocalContainer] at com.atlassian.util.concurrent.LazyReference$Sync.run(LazyReference.java:325)
[INFO] [talledLocalContainer] at com.atlassian.util.concurrent.LazyReference.getInterruptibly(LazyReference.java:143)
[INFO] [talledLocalContainer] ... 240 more
[INFO] [talledLocalContainer] Caused by: org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.jira.plugin.snIntegrationPlugin.service.integration.CronService com.jira.plugin.snIntegrationPlugin.servlet.AdminServlet1.cronService; nested exception is org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.jira.plugin.snIntegrationPlugin.service.integration.CronService] is defined: expected single matching bean but found 2: CronServiceImpl,cronServiceImpl
[INFO] [talledLocalContainer] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:561)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:88)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessPropertyValues(AutowiredAnnotationBeanPostProcessor.java:331)
[INFO] [talledLocalContainer] ... 256 more
[INFO] [talledLocalContainer] Caused by: org.springframework.beans.factory.NoUniqueBeanDefinitionException: No qualifying bean of type [com.jira.plugin.snIntegrationPlugin.service.integration.CronService] is defined: expected single matching bean but found 2: CronServiceImpl,cronServiceImpl
[INFO] [talledLocalContainer] at org.springframework.beans.factory.support.DefaultListableBeanFactory.resolveDependency(DefaultListableBeanFactory.java:942)
[INFO] [talledLocalContainer] at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:533)
[INFO] [talledLocalContainer] ... 258 more
Thanks in advance..
Check this documentation:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.