Я пытаюсь установить веб-пакет в Apache Karaf 4.4.6
Все работает нормально, кроме контроллера.
Это все равно, что увидеть аннотацию и не зарегистрировать ее . Я попробовал свою войну на сервере Jetty и Tomcat, и оба работают отлично, я не знаю, чего не хватает
mvn clean install
а затем
bundle:install -s webbundle:file:location.war?Web-ContextPath=tutorial-app
и он должен направить вас в /home, но это не работает, и привод работает нормально.
/**
*
*/
package com.swathisprasad.springboot;
import java.net.MalformedURLException;
import java.net.URL;
import javax.servlet.ServletContext;
import javax.servlet.ServletRegistration;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.support.SpringBootServletInitializer;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.core.annotation.Order;
import org.springframework.core.io.ClassPathResource;
import org.springframework.core.io.Resource;
import org.springframework.core.io.UrlResource;
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
import org.springframework.core.io.support.ResourcePatternResolver;
import org.springframework.web.WebApplicationInitializer;
import org.springframework.web.context.support.AnnotationConfigWebApplicationContext;
import org.springframework.web.servlet.DispatcherServlet;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import com.swathisprasad.springboot.controller.HomeController;
/**
* @author Swathi
*
*/
@Order(1)
@SpringBootApplication
@EnableWebMvc
@Configuration
@ComponentScan("com.swathisprasad.springboot.controller")
public class Application extends SpringBootServletInitializer implements WebApplicationInitializer{
public static void main(String[] args) {
HomeController h = new HomeController();
System.err.println(h.home()+"111");
SpringApplication.run(Application.class, args);
}
}
контроллер
@RestController
public class HomeController {
@GetMapping("/home")
public String home() {
System.err.println("Test from deem");
return "deem";
}
}
pom.xml
4.0.0
com.swathisprasad.tutorial
tutorial-parent
0.0.1-SNAPSHOT
tutorial-server
war
org.springframework.boot
spring-boot-starter-web
org.springframework.boot
spring-boot-starter-tomcat
org.springframework.boot
spring-boot-starter-jetty
org.springframework.boot
spring-boot-starter-actuator
org.springframework.boot
spring-boot-starter-jetty
provided
org.springframework.boot
spring-boot-starter-test
test
org.springframework.boot
spring-boot-starter-aop
org.springframework.boot
spring-boot-starter-integration
com.swathisprasad.tutorial
tutorial-web
${project.version}
runtime
javax.servlet
javax.servlet-api
org.eclipse.jetty
jetty-server
maven-resources-plugin
copy-resources
validate
copy-resources
${project.build.directory}/classes/resources/static/
${project.parent.basedir}/tutorial-web/src/main/web/dist/np-app/
org.apache.maven.plugins
maven-failsafe-plugin
org.apache.maven.plugins
maven-surefire-plugin
--add-opens java.base/java.lang=ALL-UNNAMED
org.springframework.boot
spring-boot-maven-plugin
org.apache.maven.plugins
maven-war-plugin
WEB-INF/lib/tomcat-*.jar
tutorial-app
Подробнее здесь: https://stackoverflow.com/questions/791 ... deployment
Развертывание войны Апач Караф ⇐ JAVA
-
- Похожие темы
- Ответы
- Просмотры
- Последнее сообщение
-
-
Развертывание войны на автономном Tomcat с настройкой контекста в приложении (Spring Boot)
Anonymous » » в форуме JAVA - 0 Ответы
- 8 Просмотры
-
Последнее сообщение Anonymous
-
-
-
Как исправить Апач? Потому что он не запускается, когда я нажимаю «Пуск»
Anonymous » » в форуме Apache - 0 Ответы
- 82 Просмотры
-
Последнее сообщение Anonymous
-