Home  >  Q&A  >  body text

java - When using dozer in Springboot, how to avoid dozer looking for its agreed configuration file dozer.properties every time the application is started?

Just like the title. Dozer mapper was added to my project, gradle dependency: compile("net.sf.dozer:dozer:5.4.0"), I did not set the dozer.properties file, but directly configured one javabean, the code is as follows:

@Configuration
public class DozerConfig {

    @Bean
    public DozerBeanMapperFactoryBean mapper() {
        return new DozerBeanMapperFactoryBean();
    }
}

, and then the question is: every time I start this application, dozer will search for the dozer.properties file, which takes about half a minute. Is there any way for me to remove this search process through configuration? Startup log related content:

2017-06-06 20:57:49.908 [restartedMain] INFO  o.s.b.c.e.ServletRegistrationBean -  Mapping servlet: 'dispatcherServlet' to [/]
2017-06-06 20:58:14.274 [restartedMain] INFO  org.dozer.config.GlobalSettings -  Trying to find Dozer configuration file: dozer.properties
2017-06-06 20:58:14.281 [restartedMain] WARN  org.dozer.config.GlobalSettings -  Dozer configuration file not found: dozer.properties.  Using defaults for all Dozer global properties.
2017-06-06 20:58:14.283 [restartedMain] INFO  org.dozer.DozerInitializer -  Initializing Dozer. Version: 5.4.0, Thread Name: restartedMain
ringa_leeringa_lee2666 days ago2089

reply all(1)I'll reply

  • 过去多啦不再A梦

    过去多啦不再A梦2017-06-12 09:24:38

    Dozer’s configuration file cannot be omitted, the object-relational mapping must be defined in the xml file. If you are in the project integration stage, you may consider using mapstruct.

    reply
    0
  • Cancelreply