1.3.7.RELEASE -> 1.4.1.RELEASE | java.lang.NoSuchMethodError: org.springframework.boot.builder.SpringApplicationBuilder.showBanner -


if switch new version of springboot, above error message when starting application. why that?

best wishes steven

pom.xml

<?xml version="1.0" encoding="utf-8"?> <project xmlns="http://maven.apache.org/pom/4.0.0"      xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"      xsi:schemalocation="http://maven.apache.org/pom/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelversion>4.0.0</modelversion>  <groupid>de.xyz.microservice</groupid> <artifactid>spring-boot-test</artifactid> <version>1.0-snapshot</version>  <parent>     <groupid>org.springframework.boot</groupid>     <artifactid>spring-boot-starter-parent</artifactid>     <!--version>1.3.7.release</version-->     <version>1.4.1.release</version> </parent> <dependencies>     <dependency>         <groupid>org.springframework.boot</groupid>         <artifactid>spring-boot-starter-web</artifactid>     </dependency> </dependencies>  </project> 

stacktrace:

exception in thread "main" java.lang.nosuchmethoderror:                    org.springframework.boot.builder.springapplicationbuilder.showbanner(z)lorg/springframework/boot/builder/springapplicationbuilder; @ org.springframework.cloud.bootstrap.bootstrapapplicationlistener.bootstrapservicecontext(bootstrapapplicationlistener.java:109) @ org.springframework.cloud.bootstrap.bootstrapapplicationlistener.onapplicationevent(bootstrapapplicationlistener.java:75)... 

mainclass:

@springbootapplication @componentscan(value = "de.xyzs.microservice") @enableaspectjautoproxy(proxytargetclass = true)  public class mainclass {      public static void main(string[] args) {         springapplication.run(mainclass.class, args);     } } 

when working spring boot 1.4.1.release, have changed

new springapplicationbuilder().showbanner()

to

new springapplicationbuilder().bannermode(banner.mode bannermode)

where banner.mode bannermodeexpects enum either: console, log, or off.

examples:

new springapplicationbuilder().bannermode(banner.mode.console); //prints banner system.out  new springapplicationbuilder().bannermode(banner.mode.log); //prints banner log file  new springapplicationbuilder().bannermode(banner.mode.off); //disables banner 

if looking banner printed, go first one, banner.mode.console

your new main method this:

public static void main(string[] args){      //springapplicationbuilder() returns applicationcontext, creating variable optional     applicationcontext ctx = new springapplicationbuilder().bannermode(banner.mode.console).run(args);      //now, if need else applicationcontext, can (such print beans, etc.) } 

here java doc springapplicationbuilder:

http://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/builder/springapplicationbuilder.html#bannermode-org.springframework.boot.banner.mode-

and here java doc explaining banner.mode enum:

http://docs.spring.io/spring-boot/docs/current/api/org/springframework/boot/banner.mode.html


Comments

Popular posts from this blog

python - How to insert QWidgets in the middle of a Layout? -

python - serve multiple gunicorn django instances under nginx ubuntu -

module - Prestashop displayPaymentReturn hook url -