zoukankan      html  css  js  c++  java
  • Spring Boot 部署到weblogic 12c

    gradle:

    buildscript {
        ext {
            springBootVersion = '1.5.3.RELEASE'
        }
        repositories {
            mavenCentral()
        }
        dependencies {
            classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
        }
    }
    apply plugin: 'war'
    apply plugin: 'java'
    apply plugin: 'eclipse'
    apply plugin: 'org.springframework.boot'
    
    version = ''
    sourceCompatibility = 1.7
    
    repositories {
        mavenCentral()
    }
    
    
    dependencies {
        compile('org.springframework.boot:spring-boot-starter-web')
        testCompile('org.springframework.boot:spring-boot-starter-test')
        providedRuntime 'org.springframework.boot:spring-boot-starter-tomcat'
    }
    DemooApplication.class:
    package com.example;
    
    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.web.WebApplicationInitializer;
    
    @SpringBootApplication
    public class DemooApplication extends SpringBootServletInitializer implements WebApplicationInitializer {
        @Override
        protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
            return application.sources(DemooApplication.class);
        }
        public static void main(String[] args) {
            SpringApplication.run(DemooApplication.class, args);
        }
    }

    然后刷新gradle,构建一次,会发现项目下会自动新建一个文件夹:webapp 是个有蓝点图标的文件夹如下图,然后在文件夹下 新建:weblogic.xml

    weblogic.xml:

    <?xml version="1.0" encoding="UTF-8"?>
    <wls:weblogic-web-app
        xmlns:wls="http://xmlns.oracle.com/weblogic/weblogic-web-app"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
            http://java.sun.com/xml/ns/javaee/ejb-jar_3_0.xsd
            http://xmlns.oracle.com/weblogic/weblogic-web-app
            http://xmlns.oracle.com/weblogic/weblogic-web-app/1.4/weblogic-web-app.xsd">
        <wls:container-descriptor>
            <wls:prefer-application-packages>
                <wls:package-name>org.slf4j</wls:package-name>
            </wls:prefer-application-packages>
        </wls:container-descriptor>
         <wls:context-root>/demoo</wls:context-root>
    </wls:weblogic-web-app>

    构建、部署即可,springboot基于servlet3.0 , weblogic 11g不支持servlet3.0,所以在weblogic11g上不能用(或许有其他办法吧)

    参考链接:http://docs.spring.io/spring-boot/docs/current/reference/html/howto-traditional-deployment.html

  • 相关阅读:
    SpringMvc完成ajax功能
    接收的参数为日期类型
    Mybatis的逆向工程(generator)以及分页助手(pageHelper)
    springMVC静态资源的映射
    Mybatis框架
    写一个简单的SpringMvc的demo
    SpringMvc流程
    controller进行数据保存以及如何进行重定向跳转
    我爱C语言
    三列布局中有两列内容固定
  • 原文地址:https://www.cnblogs.com/6324/p/6830893.html
Copyright © 2011-2022 走看看