0
votes

I am trying to combine the Activiti Angular app and the Activiti rest api Spring boot starter in one Spring boot project.

So here is the pom.xml of the project

<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>

I placed the index.html under /resources/templates folder and the css and js files under the /resources/static folder.

Then I have set up a simple spring controller that serves the index.html when requesting /home.

The problem is when I request /home, the browser fails to retrieve any css or js files. Here is what the log prints:

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'

But when I remove all the activiti dependencies the login page is displayed correctly with all the css and js files.

I can't figure out what Spring Configuration classes in activiti jars are causing this issue nor how to fix it. I need help.

1

1 Answers

1
votes

activiti-spring-boot-starter-rest-api will autoconfigure spring security for you.

You may try this,

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