Wicket + Spring Boot Deployment + .war

Based on an example here: https://github.com/Pentadrago/spring-boot-example-wicket
And taking into account the jar-to-war manual here: https://spring.io/guides/gs/convert-jar- to-war /
I would like to convert an existing Wicket + Spring (using data-jpa and security) to Spring Boot. It was pretty easy to get the fat jar setting to work, but so far I have not been able to convert this setting to a .war file for deployment to Tomcat.

The problem comes from conflicting instructions:

  • on the one hand extends org.springframework.boot.context.web.SpringBootServletInitializer

    from the class not @Configuration

    for the jar-to-war conversion guide,
  • and on the other implements org.springframework.boot.context.embedded.ServletContextInitializer

    for the @Configuration

    marked class for the example of a capillary pan.

I was unable to align the two such that I end up with a working application both when debugging with an embedded container, and when deploying it as a .war in Tomcat.

Can anyone tell me how I can set up a wicket app with w862> -boot support that can be deployed as a .war file?

+3


source to share


1 answer


What I did and got the app to work was this:

I checked the example https://github.com/Pentadrago/spring-boot-example-wicket that you posted.

Then, following the code at https://spring.io/guides/gs/convert-jar-to-war/ , all I did was make the following changes:

Change build.gradle

to:

buildscript {
    repositories {
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:1.0.2.RELEASE")
    }
}

apply plugin: 'java'
apply plugin: 'spring-boot'
apply plugin: 'war'

jar {
    version =  '0.0.1'
}

repositories {
    mavenCentral()
}

configurations {
    providedRuntime
}

dependencies {
    compile(
        "org.springframework.boot:spring-boot-starter",
        "org.springframework.boot:spring-boot-starter-logging",

        "org.springframework:spring-web:4.0.3.RELEASE",
        "org.apache.wicket:wicket-spring:6.15.0",
        )

    testCompile(
        "org.springframework.boot:spring-boot-starter-test",
    )

    providedRuntime("org.springframework.boot:spring-boot-starter-tomcat")
}

      

Add the following class:



HelloWebXml.java

package spring.boot.example.wicket;

import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.context.web.SpringBootServletInitializer;

public class HelloWebXml extends SpringBootServletInitializer {

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

      

The ones with only the changes I pushed and deployed in Tomcat 7 no problem.

Here is an excerpt from the magazine that shows that the wicked began

2014-08-27 20:57:41.396 INFO 2708 --- [on(3)-127.0.0.1] org.apache.wicket.Application : [wicket-filter] init: Wicket core library initializer

I'm not sure what your source of confusion is, but you should understand that SpringBootServletInitializer

both ServletContextInitializer

serve different purposes.

+2


source







All Articles