Friday, August 31, 2018

How to migrate existing Spring project to Spring Boot

Leave a Comment

I'm trying to migrate existing Spring project to Spring Boot. In project already used Spring Data JPA/Hibernate and simple DAO with JDBC (PostgreSQL used). In few states I found that all that I need to migrate on Spring boot, is:

  1. Add necessary dependencies
  2. Add entry point @SpringBootApplication
  3. profit, that's all.

1) Dependencies:

<dependencyManagement>         <dependencies>             <dependency>                 <groupId>org.springframework.boot</groupId>                 <artifactId>spring-boot-dependencies</artifactId>                 <version>${spring.boot.version}</version>                 <type>pom</type>                 <scope>import</scope>             </dependency>          </dependencies>     </dependencyManagement> <dependency>         <groupId>org.springframework.boot</groupId>         <artifactId>spring-boot-starter-test</artifactId>         <scope>test</scope>     </dependency>     <dependency>         <groupId>com.fasterxml.jackson.core</groupId>         <artifactId>jackson-databind</artifactId>         <version>2.9.4</version>     </dependency> <dependency>             <groupId>org.springframework.data</groupId>             <artifactId>spring-data-jpa</artifactId>             <version>2.0.5.RELEASE</version>         </dependency> <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-starter-data-jpa</artifactId>             <version>1.4.7.RELEASE</version>         </dependency> <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-starter-jetty</artifactId>             <version>1.4.7.RELEASE</version>         </dependency> 

With dependencyManagment section I have error:

Exception in thread "main" java.lang.NoSuchMethodError: org.springframework.data.repository.config.RepositoryConfigurationSource.getAttribute(Ljava/lang/String;)Ljava/util/Optional;     at org.springframework.data.jpa.repository.config.JpaRepositoryConfigExtension.postProcess(JpaRepositoryConfigExtension.java:125)     at org.springframework.data.repository.config.RepositoryConfigurationDelegate.registerRepositoriesIn(RepositoryConfigurationDelegate.java:127)     at org.springframework.data.repository.config.RepositoryBeanDefinitionRegistrarSupport.registerBeanDefinitions(RepositoryBeanDefinitionRegistrarSupport.java:83)     at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsFromRegistrars(ConfigurationClassBeanDefinitionReader.java:359)     at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitionsForConfigurationClass(ConfigurationClassBeanDefinitionReader.java:143)     at org.springframework.context.annotation.ConfigurationClassBeanDefinitionReader.loadBeanDefinitions(ConfigurationClassBeanDefinitionReader.java:116)     at org.springframework.context.annotation.ConfigurationClassPostProcessor.processConfigBeanDefinitions(ConfigurationClassPostProcessor.java:320)     at org.springframework.context.annotation.ConfigurationClassPostProcessor.postProcessBeanDefinitionRegistry(ConfigurationClassPostProcessor.java:228)     at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanDefinitionRegistryPostProcessors(PostProcessorRegistrationDelegate.java:272)     at org.springframework.context.support.PostProcessorRegistrationDelegate.invokeBeanFactoryPostProcessors(PostProcessorRegistrationDelegate.java:92)     at org.springframework.context.support.AbstractApplicationContext.invokeBeanFactoryPostProcessors(AbstractApplicationContext.java:687)     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:525)     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)     at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)     at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)     at ru.testproject.BootConfiguration.main(BootConfiguration.java:26) 

And without it:

Exception in thread "main" org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is java.lang.NoClassDefFoundError: org/eclipse/jetty/util/DeprecationWarning     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:137)     at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)     at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)     at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)     at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1118)     at org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)     at ru.testproject.BootConfiguration.main(BootConfiguration.java:26) Caused by: java.lang.NoClassDefFoundError: org/eclipse/jetty/util/DeprecationWarning     at org.eclipse.jetty.servlet.ServletContextHandler.<init>(ServletContextHandler.java:159)     at org.eclipse.jetty.webapp.WebAppContext.<init>(WebAppContext.java:289)     at org.eclipse.jetty.webapp.WebAppContext.<init>(WebAppContext.java:211)     at org.springframework.boot.context.embedded.jetty.JettyEmbeddedWebAppContext.<init>(JettyEmbeddedWebAppContext.java:28)     at org.springframework.boot.context.embedded.jetty.JettyEmbeddedServletContainerFactory.getEmbeddedServletContainer(JettyEmbeddedServletContainerFactory.java:170)     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.java:164)     at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.java:134)     ... 8 more Caused by: java.lang.ClassNotFoundException: org.eclipse.jetty.util.DeprecationWarning     at java.net.URLClassLoader.findClass(URLClassLoader.java:381)     at java.lang.ClassLoader.loadClass(ClassLoader.java:424)     at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)     at java.lang.ClassLoader.loadClass(ClassLoader.java:357) 

2) entry point (I'm also tried to Import configuration classes, commented):

@SpringBootApplication //@Import({DatabaseConfig.class, WebMvcConfig.class, WebAppConfig.class, WebSecurityConfig.class, WebServiceConfig.class}) public class BootConfiguration extends SpringBootServletInitializer {      public static void main(String[] args) {         SpringApplication.run(BootConfiguration.class, args); //        SpringApplication.run(new Class<?>[] {BootConfiguration.class, DatabaseConfig.class, WebMvcConfig.class, WebAppConfig.class, WebSecurityConfig.class, WebServiceConfig.class}, args);     }      @Bean     public JettyEmbeddedServletContainerFactory jettyEmbeddedServletContainerFactory() {         JettyEmbeddedServletContainerFactory jettyContainer =                 new JettyEmbeddedServletContainerFactory();          jettyContainer.setPort(9000);         jettyContainer.setContextPath("");         return jettyContainer;     }      @Override     protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {         return application.sources(BootConfiguration.class);     } } 

And configuration:

@Configuration @EnableAutoConfiguration(exclude = {DataSourceAutoConfiguration.class, DataSourceTransactionManagerAutoConfiguration.class, HibernateJpaAutoConfiguration.class}) @EnableJpaRepositories(basePackages = {         "ru.testproject.hibernate" }) @EnableTransactionManagement @PropertySource("classpath:application.properties") public class DatabaseConfig implements TransactionManagementConfigurer {      @Bean     public DataSource dataSource() {          if (DB_TYPE_POSTGRESQL.equalsIgnoreCase(dbType)) {             return postresqlDataSource();         } else {             return h2DataSource();         }      }      @Bean     public PlatformTransactionManager annotationDrivenTransactionManager() {         return new JpaTransactionManager();     } } 

I have no idea what I'm doing wrong. What do I need to do to start spring boot application with existing Jetty server configuration?

UPDATE I've modified the main pom:

<parent>         <groupId>ru.testproject</groupId>         <artifactId>test</artifactId>         <version>1.0.1</version>     </parent>  <dependencyManagement>         <dependencies>             <dependency>                 <groupId>org.springframework.boot</groupId>                 <artifactId>spring-boot-dependencies</artifactId>                 <version>${spring.boot.version}</version>                 <type>pom</type>                 <scope>import</scope>             </dependency>          </dependencies>     </dependencyManagement> ... <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-starter-test</artifactId>             <scope>test</scope>         </dependency>         <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-starter-data-jpa</artifactId>         </dependency>         <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-starter-jetty</artifactId>         </dependency> <dependency>             <groupId>org.springframework.boot</groupId>             <artifactId>spring-boot-starter-web-services</artifactId>             <!-- <version>${spring.boot.version}</version> -->             <exclusions>                 <exclusion>                     <groupId>org.springframework.boot</groupId>                     <artifactId>spring-boot-starter-tomcat</artifactId>                 </exclusion>                  <exclusion>                     <groupId>org.springframework.boot</groupId>                     <artifactId>spring-boot-starter-logging</artifactId>                 </exclusion>                 <exclusion>                     <groupId>org.springframework.boot</groupId>                     <artifactId>spring-boot-starter-validation</artifactId>                 </exclusion>                 <exclusion>                     <groupId>org.jboss.logging</groupId>                     <artifactId>jboss-logging</artifactId>                 </exclusion>                 <exclusion>                     <groupId>com.fasterxml.jackson.core</groupId>                     <artifactId>jackson-core</artifactId>                 </exclusion>                 <exclusion>                     <groupId>com.fasterxml.jackson.core</groupId>                     <artifactId>jackson-databind</artifactId>                 </exclusion>                 <exclusion>                     <groupId>com.fasterxml.jackson.core</groupId>                     <artifactId>jackson-annotations</artifactId>                 </exclusion>                 <exclusion>                     <groupId>org.hibernate</groupId>                     <artifactId>hibernate-validator</artifactId>                 </exclusion>              </exclusions>         </dependency>  <!-- Hibernate -->         <dependency>             <groupId>org.hibernate</groupId>             <artifactId>hibernate-entitymanager</artifactId>             <version>${hibernate-version}</version>         </dependency>         <dependency>             <groupId>org.hibernate</groupId>             <artifactId>hibernate-core</artifactId>             <version>${hibernate-version}</version>         </dependency>         <dependency>             <groupId>org.hibernate.javax.persistence</groupId>             <artifactId>hibernate-jpa-2.0-api</artifactId>             <version>1.0.1.Final</version>         </dependency>  <dependency>             <groupId>org.springframework</groupId>             <artifactId>spring-webmvc</artifactId>             <version>${spring.version}</version>         </dependency>          <dependency>             <groupId>org.springframework.security</groupId>             <artifactId>spring-security-config</artifactId>             <version>4.2.1.RELEASE</version>         </dependency>          <dependency>             <groupId>org.springframework.security</groupId>             <artifactId>spring-security-web</artifactId>             <version>4.2.0.RELEASE</version>         </dependency>          <dependency>             <groupId>org.springframework.security</groupId>             <artifactId>spring-security-taglibs</artifactId>             <version>4.2.0.RELEASE</version>         </dependency>          <dependency>             <groupId>org.springframework</groupId>             <artifactId>spring-jdbc</artifactId>             <version>${spring.version}</version>         </dependency> <!-- Version 5.0.4 because ${spring.version} context fails with CandidateComponentsIndexLoader error (it introduced in 5.0.0 version) -->         <dependency>             <groupId>org.springframework</groupId>             <artifactId>spring-context</artifactId>             <version>5.0.4.RELEASE</version>         </dependency>         <dependency>             <groupId>org.springframework</groupId>             <artifactId>spring-context-support</artifactId>             <version>${spring.version}</version>         </dependency>         <dependency>             <groupId>org.springframework</groupId>             <artifactId>spring-tx</artifactId>             <version>${spring.version}</version>         </dependency>         <dependency>             <groupId>javax.xml.bind</groupId>             <artifactId>jaxb-api</artifactId>             <version>2.3.0</version>         </dependency>          <!-- Jetty embedded -->         <dependency>             <groupId>javax.servlet</groupId>             <artifactId>javax.servlet-api</artifactId>             <version>3.1.0</version>         </dependency> 

also, I've commented all tags for spring boot dependencies. mvc dependency:tree give the following output:

[INFO] --- maven-dependency-plugin:3.0.2:tree (default-cli) @ test --- [WARNING] The artifact org.hibernate:hibernate-infinispan:jar:5.3.3.Final has been relocated to org.infinispan:infinispan-hibernate-cache-v53:jar:9.3.0.Final [INFO] ru.testproject:test:jar:2.4.41-SNAPSHOT [INFO] +- org.springframework.boot:spring-boot-starter-test:jar:1.5.8.RELEASE:test [INFO] |  +- org.springframework.boot:spring-boot-test:jar:1.5.8.RELEASE:test [INFO] |  |  \- org.springframework.boot:spring-boot:jar:1.5.8.RELEASE:compile [INFO] |  +- org.springframework.boot:spring-boot-test-autoconfigure:jar:1.5.8.RELEASE:test [INFO] |  |  \- org.springframework.boot:spring-boot-autoconfigure:jar:1.5.8.RELEASE:compile [INFO] |  +- com.jayway.jsonpath:json-path:jar:2.2.0:test [INFO] |  |  \- net.minidev:json-smart:jar:2.2.1:test [INFO] |  |     \- net.minidev:accessors-smart:jar:1.1:test [INFO] |  +- org.assertj:assertj-core:jar:2.6.0:test [INFO] |  +- org.mockito:mockito-core:jar:1.10.19:test [INFO] |  |  \- org.objenesis:objenesis:jar:2.1:test [INFO] |  +- org.hamcrest:hamcrest-core:jar:1.3:test [INFO] |  +- org.hamcrest:hamcrest-library:jar:1.3:test [INFO] |  +- org.skyscreamer:jsonassert:jar:1.4.0:test [INFO] |  |  \- com.vaadin.external.google:android-json:jar:0.0.20131108.vaadin1:test [INFO] |  +- org.springframework:spring-core:jar:4.3.12.RELEASE:compile [INFO] |  \- org.springframework:spring-test:jar:4.3.12.RELEASE:test [INFO] +- org.springframework.boot:spring-boot-starter-data-jpa:jar:1.5.8.RELEASE:compile [INFO] |  +- org.springframework.boot:spring-boot-starter:jar:1.5.8.RELEASE:compile [INFO] |  |  +- org.springframework.boot:spring-boot-starter-logging:jar:1.5.8.RELEASE:compile [INFO] |  |  |  +- ch.qos.logback:logback-classic:jar:1.1.11:compile [INFO] |  |  |  |  \- ch.qos.logback:logback-core:jar:1.1.11:compile [INFO] |  |  |  +- org.slf4j:jul-to-slf4j:jar:1.7.25:compile [INFO] |  |  |  \- org.slf4j:log4j-over-slf4j:jar:1.7.25:compile [INFO] |  |  \- org.yaml:snakeyaml:jar:1.17:runtime [INFO] |  +- org.springframework.boot:spring-boot-starter-aop:jar:1.5.8.RELEASE:compile [INFO] |  |  \- org.aspectj:aspectjweaver:jar:1.8.11:compile [INFO] |  +- org.springframework.boot:spring-boot-starter-jdbc:jar:1.5.8.RELEASE:compile [INFO] |  |  \- org.apache.tomcat:tomcat-jdbc:jar:8.5.23:compile [INFO] |  |     \- org.apache.tomcat:tomcat-juli:jar:8.5.23:compile [INFO] |  +- javax.transaction:javax.transaction-api:jar:1.2:compile [INFO] |  +- org.springframework.data:spring-data-jpa:jar:1.11.8.RELEASE:compile [INFO] |  |  +- org.springframework.data:spring-data-commons:jar:1.13.8.RELEASE:compile [INFO] |  |  +- org.springframework:spring-orm:jar:4.3.12.RELEASE:compile [INFO] |  |  \- org.slf4j:jcl-over-slf4j:jar:1.7.25:compile [INFO] |  \- org.springframework:spring-aspects:jar:4.3.12.RELEASE:compile [INFO] +- org.springframework.boot:spring-boot-starter-jetty:jar:1.5.8.RELEASE:compile [INFO] |  +- org.eclipse.jetty:jetty-webapp:jar:9.4.7.v20170914:compile [INFO] |  |  +- org.eclipse.jetty:jetty-xml:jar:9.4.7.v20170914:compile [INFO] |  |  \- org.eclipse.jetty:jetty-servlet:jar:9.4.7.v20170914:compile [INFO] |  |     \- org.eclipse.jetty:jetty-security:jar:9.4.7.v20170914:compile [INFO] |  |        \- org.eclipse.jetty:jetty-server:jar:9.4.7.v20170914:compile [INFO] |  +- org.eclipse.jetty.websocket:websocket-server:jar:9.4.7.v20170914:compile [INFO] |  |  +- org.eclipse.jetty.websocket:websocket-common:jar:9.4.7.v20170914:compile [INFO] |  |  |  \- org.eclipse.jetty.websocket:websocket-api:jar:9.4.7.v20170914:compile [INFO] |  |  +- org.eclipse.jetty.websocket:websocket-client:jar:9.4.7.v20170914:compile [INFO] |  |  |  \- org.eclipse.jetty:jetty-client:jar:9.4.7.v20170914:compile [INFO] |  |  \- org.eclipse.jetty.websocket:websocket-servlet:jar:9.4.7.v20170914:compile [INFO] |  +- org.eclipse.jetty.websocket:javax-websocket-server-impl:jar:9.4.7.v20170914:compile [INFO] |  |  +- org.eclipse.jetty:jetty-annotations:jar:9.4.7.v20170914:compile [INFO] |  |  |  +- org.eclipse.jetty:jetty-plus:jar:9.4.7.v20170914:compile [INFO] |  |  |  +- javax.annotation:javax.annotation-api:jar:1.2:compile [INFO] |  |  |  +- org.ow2.asm:asm:jar:5.1:compile [INFO] |  |  |  \- org.ow2.asm:asm-commons:jar:5.1:compile [INFO] |  |  |     \- org.ow2.asm:asm-tree:jar:5.1:compile [INFO] |  |  +- org.eclipse.jetty.websocket:javax-websocket-client-impl:jar:9.4.7.v20170914:compile [INFO] |  |  \- javax.websocket:javax.websocket-api:jar:1.0:compile [INFO] |  \- org.mortbay.jasper:apache-el:jar:8.0.33:compile [INFO] +- commons-fileupload:commons-fileupload:jar:1.3.1:compile [INFO] +- org.springframework.boot:spring-boot-starter-web-services:jar:1.5.8.RELEASE:compile [INFO] |  +- org.springframework.boot:spring-boot-starter-web:jar:1.5.8.RELEASE:compile [INFO] |  +- org.springframework:spring-oxm:jar:4.3.12.RELEASE:compile [INFO] |  \- org.springframework.ws:spring-ws-core:jar:2.4.0.RELEASE:compile [INFO] |     \- org.springframework.ws:spring-xml:jar:2.4.0.RELEASE:compile [INFO] +- org.hibernate:hibernate-entitymanager:jar:5.3.3.Final:compile [INFO] |  +- org.jboss.logging:jboss-logging:jar:3.3.1.Final:compile [INFO] |  +- dom4j:dom4j:jar:1.6.1:compile [INFO] |  +- org.hibernate.common:hibernate-commons-annotations:jar:5.0.4.Final:compile [INFO] |  +- javax.persistence:javax.persistence-api:jar:2.2:compile [INFO] |  +- net.bytebuddy:byte-buddy:jar:1.8.13:compile [INFO] |  \- org.jboss.spec.javax.transaction:jboss-transaction-api_1.2_spec:jar:1.1.1.Final:compile [INFO] +- org.hibernate:hibernate-core:jar:5.3.3.Final:compile [INFO] |  +- org.javassist:javassist:jar:3.21.0-GA:compile [INFO] |  +- antlr:antlr:jar:2.7.7:compile [INFO] |  +- org.jboss:jandex:jar:2.0.5.Final:compile [INFO] |  +- com.fasterxml:classmate:jar:1.3.4:compile [INFO] |  \- javax.activation:javax.activation-api:jar:1.2.0:compile [INFO] +- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile [INFO] +- org.hibernate:hibernate-osgi:jar:5.3.3.Final:compile [INFO] |  +- javax.interceptor:javax.interceptor-api:jar:1.2:compile [INFO] |  +- org.osgi:org.osgi.core:jar:6.0.0:compile [INFO] |  \- org.osgi:org.osgi.compendium:jar:5.0.0:compile [INFO] +- org.hibernate:hibernate-envers:jar:5.3.3.Final:compile [INFO] +- org.hibernate:hibernate-hikaricp:jar:5.3.3.Final:compile [INFO] +- org.hibernate:hibernate-proxool:jar:5.3.3.Final:compile [INFO] |  \- proxool:proxool:jar:0.8.3:compile [INFO] +- org.infinispan:infinispan-hibernate-cache-v53:jar:9.3.0.Final:compile [INFO] |  +- org.infinispan:infinispan-hibernate-cache-commons:jar:9.3.0.Final:compile [INFO] |  +- org.infinispan:infinispan-hibernate-cache-spi:jar:9.3.0.Final:compile [INFO] |  \- org.infinispan:infinispan-core:jar:9.3.0.Final:compile [INFO] |     +- org.infinispan:infinispan-commons:jar:9.3.0.Final:compile [INFO] |     +- org.jgroups:jgroups:jar:4.0.12.Final:compile [INFO] |     +- com.github.ben-manes.caffeine:caffeine:jar:2.3.5:compile [INFO] |     +- org.jboss.spec.javax.transaction:jboss-transaction-api_1.1_spec:jar:1.0.1.Final:compile [INFO] |     +- org.jboss.marshalling:jboss-marshalling-osgi:jar:2.0.5.Final:compile [INFO] |     \- io.reactivex.rxjava2:rxjava:jar:2.1.3:compile [INFO] |        \- org.reactivestreams:reactive-streams:jar:1.0.1:compile [INFO] +- org.hibernate:hibernate-ehcache:jar:5.3.3.Final:compile [INFO] |  \- net.sf.ehcache:ehcache:jar:2.10.4:compile [INFO] +- wsdl4j:wsdl4j:jar:1.6.1:compile [INFO] +- org.springframework:spring-webmvc:jar:4.3.12.RELEASE:compile [INFO] |  +- org.springframework:spring-aop:jar:4.3.12.RELEASE:compile [INFO] |  +- org.springframework:spring-beans:jar:4.3.12.RELEASE:compile [INFO] |  +- org.springframework:spring-expression:jar:4.3.12.RELEASE:compile [INFO] |  \- org.springframework:spring-web:jar:4.3.12.RELEASE:compile [INFO] +- org.springframework.security:spring-security-config:jar:4.2.1.RELEASE:compile [INFO] |  +- aopalliance:aopalliance:jar:1.0:compile [INFO] |  \- org.springframework.security:spring-security-core:jar:4.2.3.RELEASE:compile [INFO] +- org.springframework.security:spring-security-web:jar:4.2.0.RELEASE:compile [INFO] +- org.springframework.security:spring-security-taglibs:jar:4.2.0.RELEASE:compile [INFO] |  \- org.springframework.security:spring-security-acl:jar:4.2.3.RELEASE:compile [INFO] +- org.springframework:spring-jdbc:jar:4.3.12.RELEASE:compile [INFO] +- org.springframework:spring-context:jar:5.0.4.RELEASE:compile [INFO] +- org.springframework:spring-context-support:jar:4.3.12.RELEASE:compile [INFO] +- org.springframework:spring-tx:jar:4.3.12.RELEASE:compile [INFO] +- javax.xml.bind:jaxb-api:jar:2.3.0:compile [INFO] +- javax.servlet:javax.servlet-api:jar:3.1.0:compile [INFO] +- javax.inject:javax.inject:jar:1:compile [INFO] +- commons-configuration:commons-configuration:jar:1.10:compile [INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile [INFO] +- commons-lang:commons-lang:jar:2.6:compile [INFO] +- junit:junit:jar:4.11:test [INFO] +- org.jdom:jdom:jar:2.0.2:compile [INFO] +- commons-io:commons-io:jar:2.4:compile [INFO] +- xalan:xalan:jar:2.7.2:compile [INFO] |  \- xalan:serializer:jar:2.7.2:compile [INFO] |     \- xml-apis:xml-apis:jar:1.4.01:compile [INFO] +- org.apache.derby:derby:jar:10.11.1.1:compile [INFO] +- org.postgresql:postgresql:jar:42.1.1:compile [INFO] +- com.zaxxer:HikariCP:jar:2.6.3:compile [INFO] |  \- org.slf4j:slf4j-api:jar:1.7.25:compile [INFO] +- jaxen:jaxen:jar:1.1.6:compile [INFO] +- ru.testproject:test-conf:jar:2.4.41-SNAPSHOT:compile [INFO] |  +- log4j:log4j:jar:1.2.16:compile [INFO] |  +- org.slf4j:slf4j-log4j12:jar:1.7.25:compile [INFO] |  \- ru.testproject:test-util:jar:2.4.41-SNAPSHOT:compile [INFO] +- com.github.spullara.mustache.java:compiler:jar:0.9.0:compile [INFO] +- org.quartz-scheduler:quartz:jar:2.2.1:compile [INFO] |  \- c3p0:c3p0:jar:0.9.1.1:compile [INFO] +- javax.json:javax.json-api:jar:1.0:compile [INFO] +- org.apache.santuario:xmlsec:jar:2.0.6:compile [INFO] |  +- org.codehaus.woodstox:woodstox-core-asl:jar:4.4.1:compile [INFO] |  |  +- javax.xml.stream:stax-api:jar:1.0-2:compile [INFO] |  |  \- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile [INFO] |  \- commons-codec:commons-codec:jar:1.10:compile [INFO] +- org.eclipse.jetty:jetty-servlets:jar:9.3.5.v20151012:compile [INFO] |  +- org.eclipse.jetty:jetty-continuation:jar:9.4.7.v20170914:compile [INFO] |  +- org.eclipse.jetty:jetty-http:jar:9.4.7.v20170914:compile [INFO] |  +- org.eclipse.jetty:jetty-util:jar:9.4.7.v20170914:compile [INFO] |  \- org.eclipse.jetty:jetty-io:jar:9.4.7.v20170914:compile [INFO] +- com.itextpdf:itextpdf:jar:5.5.12:compile [INFO] +- org.bouncycastle:bcprov-jdk15on:jar:1.55:compile [INFO] +- org.bouncycastle:bcmail-jdk15on:jar:1.55:compile [INFO] +- org.bouncycastle:bcpkix-jdk15on:jar:1.55:compile [INFO] +- com.google.guava:guava:jar:24.0-jre:compile [INFO] |  +- com.google.code.findbugs:jsr305:jar:1.3.9:compile [INFO] |  +- org.checkerframework:checker-compat-qual:jar:2.0.0:compile [INFO] |  +- com.google.errorprone:error_prone_annotations:jar:2.1.3:compile [INFO] |  +- com.google.j2objc:j2objc-annotations:jar:1.1:compile [INFO] |  \- org.codehaus.mojo:animal-sniffer-annotations:jar:1.14:compile [INFO] +- org.dom4j:dom4j:jar:2.1.0:compile [INFO] +- com.fasterxml.jackson.core:jackson-databind:jar:2.8.10:compile [INFO] |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile [INFO] |  \- com.fasterxml.jackson.core:jackson-core:jar:2.8.10:compile [INFO] +- commons-net:commons-net:jar:3.6:compile [INFO] +- org.samba.jcifs:jcifs:jar:1.2.19:compile [INFO] \- org.reflections:reflections:jar:0.9.11:compile [INFO] ------------------------------------------------------------------------ [INFO] BUILD SUCCESS [INFO] ------------------------------------------------------------------------ [INFO] Total time: 15.788 s [INFO] Finished at: 2018-08-22T11:11:41+03:00 [INFO] ------------------------------------------------------------------------ 

Anyway, I have the same issue at application startup:

    Warning: SLF4J: Class path contains multiple SLF4J bindings.     33:08.275 [main] DEBUG org.springframework.boot.logging.ClasspathLoggingApplicationListener - Application failed to start with classpath:  [main] ERROR org.springframework.boot.SpringApplication - Application startup failed java.lang.NoSuchMethodError: org.springframework.util.ObjectUtils.unwrapOptional(Ljava/lang/Object;)Ljava/lang/Object;         at org.springframework.validation.DataBinder.<init>(DataBinder.java:179)         at org.springframework.boot.bind.RelaxedDataBinder.<init>(RelaxedDataBinder.java:83)         org.springframework.boot.context.config.ConfigFileApplicationListener.postProcessEnvironment(ConfigFileApplicationListener.java:197)         org.springframework.context.event.SimpleApplicationEventMulticaster.multicastEvent(SimpleApplicationEventMulticaster.java:127)         at org.springframework.boot.context.event.EventPublishingRunListener.environmentPrepared(EventPublishingRunListener.java:74)         at org.springframework.boot.SpringApplicationRunListeners.environmentPrepared(SpringApplicationRunListeners.java:54)         at org.springframework.boot.SpringApplication.prepareEnvironment(SpringApplication.java:325)     org.springframework.boot.SpringApplication.run(SpringApplication.java:1107)         at ru.testproject.BootConfiguration.main(BootConfiguration.java:26)     cess finished with exit code 1 

1 Answers

Answers 1

Problem solved: I fixed the dependency issues. Should use,

@Configuration @EnableAutoConfiguration @ComponentScan @Import(Config.class) 

instead @SpringBootApplication annotation.
Now the application is getting booted, but cannot find config file which is another story.

If You Enjoyed This, Take 5 Seconds To Share It

0 comments:

Post a Comment