2016-11-15 241 views
0

我創建了一個SpringBoot應用程序。 我想在我的本地服務器(Weblogic 12c)上部署它。 當我嘗試部署戰爭,我得到這個錯誤信息:如何在Weblogic應用程序服務器上部署SpringBoot應用程序?

java.lang.IllegalArgumentException:無效源型類my.company.MySpringBootApplication

這是我連累類:

package my.company; 

import org.springframework.beans.factory.annotation.Value; 
import org.springframework.boot.SpringApplication; 
import org.springframework.boot.autoconfigure.SpringBootApplication; 
import org.springframework.boot.builder.SpringApplicationBuilder; 
import org.springframework.boot.web.support.SpringBootServletInitializer; 

@SpringBootApplication 
public class MySpringBootApplication extends SpringBootServletInitializer { 

    public static void main(String[] args) { 
     SpringApplication.run(MySpringBootApplication.class, args); 
    } 

    @Override 
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 
     return application.sources(this); 
    } 
} 

我怎樣才能解決這個?

在此先感謝;)

+0

很難說沒有更多的細節。嘗試用'application.sources(MySpringBootApplication.class)' –

+0

替換非常感謝! 我已經解決了你的建議! – GradAsso

回答

0

這只是一個代這一行的事情:

package my.company; 

import org.springframework.beans.factory.annotation.Value; 
import org.springframework.boot.SpringApplication; 
import org.springframework.boot.autoconfigure.EnableAutoConfiguration; 
import org.springframework.boot.builder.SpringApplicationBuilder; 
import org.springframework.boot.web.support.SpringBootServletInitializer; 
import org.springframework.context.annotation.ComponentScan; 
import org.springframework.web.WebApplicationInitializer; 


@ComponentScan 
@EnableAutoConfiguration 
public class MySpringBootApplication extends SpringBootServletInitializer implements WebApplicationInitializer { 

    @Value("${flag.status}") 
    private String flagStatus; 

    public static void main(String[] args) { 
     SpringApplication.run(MySpringBootApplication.class, args); 
    } 

    @Override 
    protected SpringApplicationBuilder configure(SpringApplicationBuilder application) { 
     return application.sources(applicationClass); 
    } 

    private static Class<MySpringBootApplication > applicationClass = MySpringBootApplication .class; 
} 
相關問題