我正在尝试在 weblogic 12c (12.2.1) 上部署一个以 angular 为前端的 spring-boot 应用程序。我的代码可在 - https://github.com/onkar0777/Angular-SpringBoot-REST-JWT
我用 mvn clean install 创建了一场战争,它在使用 java -jar 运行时运行良好
但是,当我将相同的战争部署到 weblogic 时,在点击http://192.168.1.6:7001/myweb 时出现错误(myweb 是上下文根)
白标错误页面 此应用程序没有明确的 /error 映射,因此您将其视为后备。
Wed Aug 22 13:28:58 IST 2018 出现意外错误(type=Forbidden,status=403)。拒绝访问
我猜想以某种方式 weblogic 没有将调用定向到 MainController
package com.app.api;
import org.springframework.stereotype.*;
import org.springframework.web.bind.annotation.*;
import springfox.documentation.annotations.*;
@ApiIgnore
@Controller // Dont use RestController as this method is mapping to a static file not a JSON
public class MainController {
@RequestMapping(value={"/"})
public String index() {
return "index.html";
}
}
主应用程序
package com.app;
import javax.annotation.Resource;
import org.springframework.boot.Banner;
import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.data.jpa.repository.config.EnableJpaRepositories;
import org.springframework.transaction.annotation.EnableTransactionManagement;
import org.springframework.web.WebApplicationInitializer;
import com.app.services.StorageService;
@SpringBootApplication
@EnableJpaRepositories(basePackages ={ "com.app.repo"})
@EntityScan(basePackages ={ "com.app.model"})
@EnableTransactionManagement
public class MainApp extends SpringBootServletInitializer implements CommandLineRunner, WebApplicationInitializer {
@Resource
StorageService storageService;
@Override
public void run(String... arg) throws Exception {
storageService.deleteAll();
storageService.init();
}
相关分类