结合Activiti angular app和activiti spring boot starters

时间:2016-05-20 23:10:32

标签: angularjs spring-boot activiti

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

所以这是项目的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 文件夹下。

然后我设置了一个简单的弹簧控制器,在请求 / 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配置类导致了这个问题,也没解决如何修复它。我需要帮助。

1 个答案:

答案 0 :(得分:1)

activiti-spring-boot-starter-rest-api将为您自动配置弹簧安全保护。

你可以试试这个,

    @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
    })