Skip to content
Snippets Groups Projects
Commit 0c644141 authored by Sascha Herzinger's avatar Sascha Herzinger
Browse files

Fixed StartupBean

parent 2276e58f
No related branches found
No related tags found
2 merge requests!630WIP: Resolve "The privileges of a new user are not saved in some cases",!499Spring config update
......@@ -6,10 +6,6 @@ import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;
import javax.annotation.PostConstruct;
import javax.faces.bean.ApplicationScoped;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.ManagedProperty;
import javax.faces.context.FacesContext;
import javax.servlet.ServletContext;
......@@ -22,10 +18,13 @@ import lcsb.mapviewer.model.Project;
import lcsb.mapviewer.model.ProjectStatus;
import lcsb.mapviewer.model.map.layout.ReferenceGenome;
import lcsb.mapviewer.model.user.ConfigurationElementType;
import lcsb.mapviewer.persist.DbUtils;
import lcsb.mapviewer.services.interfaces.IConfigurationService;
import lcsb.mapviewer.services.interfaces.IProjectService;
import lcsb.mapviewer.services.interfaces.IReferenceGenomeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.event.ApplicationReadyEvent;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
/**
* Bean where init script of the application is placed. The method in this bean
......@@ -34,8 +33,7 @@ import lcsb.mapviewer.services.interfaces.IReferenceGenomeService;
* @author Piotr Gawron
*
*/
@ManagedBean(eager = true)
@ApplicationScoped
@Component
public class StartupBean {
/**
......@@ -45,34 +43,37 @@ public class StartupBean {
/**
* Dao used to access information about projects.
*
*
*/
@ManagedProperty(value = "#{ProjectService}")
private transient IProjectService projectService;
/**
* Service used to access configuration params from db.
*
*
* @see IProjectService
*/
@ManagedProperty(value = "#{ConfigurationService}")
private transient IConfigurationService configurationService;
/**
* Service used to access information about reference genomes.
*
*
* @see IReferenceGenomeService
*/
@ManagedProperty(value = "#{ReferenceGenomeService}")
private transient IReferenceGenomeService referenceGenomeService;
@ManagedProperty(value = "#{DbUtils}")
private transient DbUtils dbUtils;
@Autowired
public StartupBean(IProjectService projectService,
IConfigurationService configurationService,
IReferenceGenomeService referenceGenomeService) {
this.projectService = projectService;
this.configurationService = configurationService;
this.referenceGenomeService = referenceGenomeService;
}
/**
* Method that process initial script of application.
*/
@PostConstruct
@EventListener(ApplicationReadyEvent.class)
public void init() {
loadCustomLog4jProperties();
logger.debug("Application startup script starts");
......@@ -216,12 +217,4 @@ public class StartupBean {
public void setProjectService(IProjectService projectService) {
this.projectService = projectService;
}
public DbUtils getDbUtils() {
return dbUtils;
}
public void setDbUtils(DbUtils dbUtils) {
this.dbUtils = dbUtils;
}
}
package lcsb.mapviewer.web.config;
import lcsb.mapviewer.services.SpringServiceConfig;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import;
import org.springframework.web.servlet.config.annotation.*;
@Configuration
@EnableWebMvc
@Import({SpringServiceConfig.class})
@ComponentScan(basePackages = {"lcsb.mapviewer.web"})
public class SpringWebConfig extends WebMvcConfigurerAdapter {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment