【问题标题】:Combining Activiti angular app and activiti spring boot starters结合 Activiti angular app 和 activiti spring boot starters
【发布时间】:2016-05-20 23:10:32
【问题描述】:

我正在尝试将 Activiti Angular appActiviti rest api Spring boot starter 组合到一个 Spring Boot 项目中。

所以这里是项目的pom.xml

<dependencies>
    <dependency>
        <groupId>org.activiti</groupId>
        <artifactId>activiti-spring-boot-starter-basic</artifactId>
        <version>${activiti.version}</version>
    </dependency>
    <dependency>
        <groupId>com.h2database</groupId>
        <artifactId>h2</artifactId>
    </dependency>
    <dependency>
        <groupId>org.activiti</groupId>
        <artifactId>activiti-spring-boot-starter-rest-api</artifactId>
        <version>${activiti.version}</version>
    </dependency>
    <dependency>
        <groupId>org.activiti</groupId>
        <artifactId>activiti-spring-boot-starter-actuator</artifactId>
        <version>${activiti.version}</version>
    </dependency>
    <dependency>
        <groupId>org.activiti</groupId>
        <artifactId>activiti-spring-boot-starter-jpa</artifactId>
        <version>${activiti.version}</version>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-thymeleaf</artifactId>
    </dependency>
    <dependency>
        <groupId>net.sourceforge.nekohtml</groupId>
        <artifactId>nekohtml</artifactId>
        <version>1.9.21</version>
    </dependency>

</dependencies>

我将 index.html 放在 /resources/templates 文件夹下,将 css 和 js 文件放在 /resources/static 文件夹下。

然后我设置了一个简单的 spring 控制器,在请求 /home 时为 index.html 提供服务。

问题是当我请求 /home 时,浏览器无法检索任何 css 或 js 文件。以下是日志打印的内容:

2016-05-20 23:44:30.626  WARN 24307 --- [nio-8080-exec-2] o.s.web.servlet.PageNotFound             : No mapping found for HTTP request with URI [/styles/main.css] in DispatcherServlet with name 'dispatcherServlet'
2016-05-20 23:44:30.725  WARN 24307 --- [nio-8080-exec-3] o.s.web.servlet.PageNotFound             : No mapping found for HTTP request with URI [/styles/bootstrap.css] in DispatcherServlet with name 'dispatcherServlet'
2016-05-20 23:44:30.735  WARN 24307 --- [nio-8080-exec-6] o.s.web.servlet.PageNotFound             : No mapping found for HTTP request with URI [/components/angular-resource/angular-resource.min.js] in DispatcherServlet with name 'dispatcherServlet'
2016-05-20 23:44:30.746  WARN 24307 --- [nio-8080-exec-5] o.s.web.servlet.PageNotFound             : No mapping found for HTTP request with URI [/components/angular-route/angular-route.js] in DispatcherServlet with name 'dispatcherServlet'
2016-05-20 23:44:30.756  WARN 24307 --- [nio-8080-exec-7] o.s.web.servlet.PageNotFound             : No mapping found for HTTP request with URI [/components/angular-bootstrap/ui-bootstrap-tpls.min.js] in DispatcherServlet with name 'dispatcherServlet'
2016-05-20 23:44:30.775  WARN 24307 --- [nio-8080-exec-4] o.s.web.servlet.PageNotFound             : No mapping found for HTTP request with URI [/components/angular/angular.min.js] in DispatcherServlet with name 'dispatcherServlet'
2016-05-20 23:44:30.980  WARN 24307 --- [nio-8080-exec-9] o.s.web.servlet.PageNotFound             : No mapping found for HTTP request with URI [/components/moment/moment.js] in DispatcherServlet with name 'dispatcherServlet'
2016-05-20 23:44:31.069  WARN 24307 --- [nio-8080-exec-3] o.s.web.servlet.PageNotFound             : No mapping found for HTTP request with URI [/scripts/controllers/login.js] in DispatcherServlet with name 'dispatcherServlet'
2016-05-20 23:44:31.076  WARN 24307 --- [nio-8080-exec-8] o.s.web.servlet.PageNotFound             : No mapping found for HTTP request with URI [/components/angular-moment/angular-moment.js] in DispatcherServlet with name 'dispatcherServlet'
2016-05-20 23:44:31.084  WARN 24307 --- [nio-8080-exec-2] o.s.web.servlet.PageNotFound             : No mapping found for HTTP request with URI [/scripts/controllers/root.js] in DispatcherServlet with name 'dispatcherServlet'
2016-05-20 23:44:31.102  WARN 24307 --- [io-8080-exec-10] o.s.web.servlet.PageNotFound             : No mapping found for HTTP request with URI [/scripts/app.js] in DispatcherServlet with name 'dispatcherServlet'
2016-05-20 23:44:31.150  WARN 24307 --- [nio-8080-exec-1] o.s.web.servlet.PageNotFound             : No mapping found for HTTP request with URI [/scripts/controllers/main.js] in DispatcherServlet with name 'dispatcherServlet'

但是当我删除所有 activiti 依赖项时,登录页面会正确显示所有 css 和 js 文件。

我不知道 activiti jar 中的 Spring Configuration 类是什么导致了这个问题,也不知道如何解决它。我需要帮助。

【问题讨论】:

    标签: angularjs spring-boot activiti


    【解决方案1】:

    activiti-spring-boot-starter-rest-api 将为您自动配置 spring 安全性。

    你可以试试这个,

        @SpringBootApplication
        @EnableAutoConfiguration(exclude = {
            org.activiti.spring.boot.RestApiAutoConfiguration.class,
            org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration.class,
            org.activiti.spring.boot.SecurityAutoConfiguration.class,
            org.springframework.boot.actuate.autoconfigure.ManagementWebSecurityAutoConfiguration.class
        })  
    

    【讨论】:

      猜你喜欢
      • 2021-04-13
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多