Fix the "NoSuchBeanDefinitionException: No bean named 'transactionManager' available", when trying to run the scheduled task -during initialization- for assigning pending user roles.
This commit is contained in:
parent
59fc344730
commit
a0fd5f67a7
|
@ -1,12 +1,14 @@
|
|||
package eu.dnetlib.repo.manager;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
}
|
||||
package eu.dnetlib.repo.manager;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
|
||||
@SpringBootApplication
|
||||
@EnableScheduling
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(Application.class, args);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package eu.dnetlib.repo.manager.components;
|
||||
|
||||
|
||||
import eu.dnetlib.repo.manager.service.PendingUserRoleService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@Component
|
||||
public class ScheduledTasks {
|
||||
|
||||
@Autowired
|
||||
PendingUserRoleService pendingUserRoleService;
|
||||
|
||||
@Scheduled(fixedRate = 3_600_000)
|
||||
public void assignPendingRoles() {
|
||||
pendingUserRoleService.assignRoles();
|
||||
}
|
||||
|
||||
}
|
|
@ -5,7 +5,6 @@ import eu.dnetlib.repo.manager.repository.PendingUserRoleRepository;
|
|||
import eu.dnetlib.repo.manager.service.aai.registry.AaiRegistryService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@Service
|
||||
|
@ -21,7 +20,6 @@ public class PendingUserRoleService {
|
|||
this.aaiRegistryService = aaiRegistryService;
|
||||
}
|
||||
|
||||
@Scheduled(fixedRate = 3_600_000)
|
||||
public void assignRoles() {
|
||||
Iterable<PendingUserRole> roles = pendingUserRoleRepository.findAll();
|
||||
for (PendingUserRole role : roles) {
|
||||
|
|
Loading…
Reference in New Issue