部署Springboot到Websphere

生产环境为Websphere 8.5.5.10,所以需要部署Springboot到Webspere.

首先参考文章提到的对Application入口类的改动:

package com.springboot.data;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Configuration;

@Configuration
@SpringBootApplication
public class Application extends SpringBootServletInitializer{

	public static void main(String[] args) {
		SpringApplication.run(Application.class, args);
	}
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(Application.class);
	}
	
	
	private static SpringApplicationBuilder configureApplication(SpringApplicationBuilder builder) {
		return builder.sources(Application.class);
	}
}

然后就是POM文件的改动:



	4.0.0

	com.example
	spring-boot-wasdev-1.5.14
	0.0.1-SNAPSHOT
	war

	spring-boot-wasdev-1.5.14
	Demo project for Spring Boot

	
		org.springframework.boot
		spring-boot-starter-parent
		1.5.14.RELEASE
		 
	

	
		UTF-8
		UTF-8
		1.8
	

	
		
			org.springframework.boot
			spring-boot-starter-web
		
		
			org.springframework.boot
			spring-boot-starter-tomcat
			provided
		
		
			org.springframework.boot
			spring-boot-starter-test
			test
		
		
			javax
			javaee-api
			7.0
			provided
		
		
			javax.el
			javax.el-api
			3.0.0
		
		
	

	
		
			
				org.springframework.boot
				spring-boot-maven-plugin
			
		
	




还有web.xml的样例:



         
    SpringBoot APP NAME
    
    
        index.html
    




这样就可以部署到Websphere,不需要所谓的Share library设置。

注意Websphere 8.5.5.10需要升级Java6到Java8. 

Springboot也不能用最新的2.0.3版本,因为里面有些类是为Java9编译的。







你可能感兴趣的:(WAS)