在此示例的基础上:https://github.com/Pentadrago/spring-boot-example-wicket
并考虑到这里的jar-to-war指南:https://spring.io/guides/gs/convert-jar-to-war/
我想将我现有的Wicket Spring(使用data-jpa和安全性)转换为Spring Boot。让胖罐设置工作相当容易,但到目前为止,我不可能将此设置转换为. war文件以在Tomcat中部署。
这个问题源于对以下方面的相互矛盾的指示:
我无法将两者对齐,以便在使用嵌入式容器进行调试时以及在 Tomcat 中部署为 .war 时获得一个正常工作的应用程序。
有人能告诉我如何设置一个启用了spring-boot的wicket应用程序,我可以将其部署为. war文件吗?
我做了以下事情,并让申请生效:
我看了你发布的https://github.com/Pentadrago/spring-boot-example-wicket项目的例子。
然后按照https://spring.io/guides/gs/convert-jar-to-war/指南上的代码,我所做的就是进行以下更改:
更改build。渐变
到:
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")
}
添加以下类:
< code>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);
}
}
我对Tomcat 7所做的修改和部署没有任何问题。
这是日志的摘录,表明邪恶开始了
<代码>2014-08-27 20:57:41.396 INFO 2708---[关于(3)-127.0.0.1]org.apache.wicket。应用程序:[wicket filter]init:wicket核心库初始值设定项
我不确定你的困惑来源是什么,但你必须明白,Spring靴服务器初始化器
和Servlet上下文初始化器
有不同的目的。