Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布

最近商务经常要求我出差去给客户做演示,每次推诿商务都已自己不会部署为理由,一怒之下产生了做这件事情的想法.

首先附上pom.xml



	4.0.0

	com.example
	demo
	0.0.1-SNAPSHOT
	war

	demo
	Demo project for Spring Boot

	
		1.8
	
	
		org.springframework.boot
		spring-boot-starter-parent
		1.4.1.RELEASE
	
	
		
			org.springframework.boot
			spring-boot-starter-web
		
		
		
			com.alibaba
			druid
			1.0.26
		
		
		
			org.mybatis.spring.boot
			mybatis-spring-boot-starter
			1.1.1
		
		
		
			mysql
			mysql-connector-java
		
		
		
			org.springframework.boot
			spring-boot-devtools
			true
		
		
			org.springframework.boot
			spring-boot-starter-thymeleaf
		

		
			ojdbc
			ojdbc5
			0.0.1-SNAPSHOT
		
		
		
		
        
            org.apache.axis
            axis
            1.4
        
        
            commons-discovery
            commons-discovery
            0.2
            
                
                    commons-logging
                    commons-logging
                
            
        
        
            org.apache.axis
            axis-jaxrpc
            1.4
        
        
            org.apache.axis
            axis-saaj
            1.4
        
        
            wsdl4j
            wsdl4j
        
        

	
	
		
			
				org.springframework.boot
				spring-boot-maven-plugin
				
				
					cn.biceng.App
				
				
					
						
							repackage
						
					
				
			
		
	

本人开发工具用的MyEclipse2017

下面是目录结构,供大家参考

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第1张图片

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第2张图片

application.yml 文件:

    主要是设置端口号,数据库地址,还有html模板

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第3张图片

由于相关的jar包已经导入,所以我们直接开始愉快的编码了.

首先是启动类:

package cn.biceng;

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 App extends SpringBootServletInitializer {
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
        return application.sources(App.class);
    }
	
    public static void main(String[] args) throws Exception {
    	SpringApplication application=new SpringApplication(App.class);
    	application.run(args);
    }
}

dao层:

package cn.biceng.dao;

import org.apache.ibatis.annotations.Select;

public interface SealMapper {
	
	@Select("select login from users where id=#{id}")
	String select(String id);
}

controller层:

package cn.biceng.controller;

import java.util.Map;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import cn.biceng.dao.SealMapper;
@Controller
@EnableAutoConfiguration
@MapperScan("cn.biceng.dao")
public class SealMessageControl {

	@Autowired
	private SealMapper sealMapper;

    @RequestMapping("/")
    @ResponseBody
    String home() {
    	String s=sealMapper.select("7003");
    	System.out.println(s);
        return "哪里需要签名盖章,哪里就有百润百成";
    }
    
    @RequestMapping("/index")
    public String toIndex(Map model) {
       
    	//return "thymeleaf/index";
    	return "MyHtml";
    }
}

至此简单的springboot+mybatis框架就整合完成了

测试一波 右键main方法运行

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第4张图片

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第5张图片Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第6张图片

随后我们把前端页面也整合进来:

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第7张图片

首先在resource目录下建立如下的结构,static下放 js,css,image的资源文件

templates下面放html模板对应着application.yml的内容

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第8张图片

然后随便去菜鸟教程上面找一个demo复制下来

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第9张图片

部署启动:

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第10张图片

后面的操作就是MVC标准操作了,此处不多涉及.

然后我们整合axis.

首先jar包在pom.xml中已经导入,先准备一个wsdd文件.放在WEB-INF下面



	
	
		
		
		
		
		
		
		
		
			
				
			
			
				
				
			
		
	
	
	
	
	
	
	
		
		
		
		
		
		
		
		
	
	
	
		
			
			
		
	
	
		
			
		
	

然后对应写你需要发布的方法

package cn.biceng;

public class Axisaction {
	
	public void test(){
		System.out.println("12312312");
	}
}

然后运行

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第11张图片

大工搞成! 然后就是打包了,由于jar包不包含wabapp的内容,所以我们打成war包发布.

注意此处的

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第12张图片

随后run configurations

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第13张图片

一键搞定.

不报错的情况下我们就能在target目录下看到我们的war包

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第14张图片

找到这个war包的位置

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第15张图片

打开CMD.Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第16张图片确认有java

然后CD到该目录

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第17张图片

java -jar demo-0.0.1-SNAPSHOT.war

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第18张图片

一个重重的回车.

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第19张图片

Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第20张图片


Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布_第21张图片



你可能感兴趣的:(Springboot+Axis1.4+Mybatis(oracle)+前端html 整合发布)