Integrate Activiti to JHipster Project

好久不见. 提交于 2019-12-10 17:56:02

问题


I am trying to integrate Activiti to the JHipster Project following the instruction here : getting started with activiti and spring boot.

a few exception I am facing:

  1. conflict in 'userResource' class:

    Annotation-specified bean name 'userResource' for bean class [org.activiti.rest.service.api.identity.UserResource] conflicts with existing, non-compatible bean definition of same name and class [com.activiti.demo3.web.rest.UserResource]

For now I have renamed the userResource class that comes from jhipster, but I am not able to figure out the exception below.

  1. @Order on WebSecurityConfigurers must be unique:

Error creating bean with name 'org.springframework.security.config.annotation.web.configuration.WebSecurityConfiguration': Injection of autowired dependencies failed; nested exception is java.lang.IllegalStateException: @Order on WebSecurityConfigurers must be unique. Order of 100 was already used, so it cannot be used on org.activiti.spring.boot.RestApiAutoConfiguration$SecurityConfiguration$$EnhancerBySpringCGLIB$$320e2174@6b277aed too.

Any suggestion or pointers would be really helpful. Thanks in advance.


回答1:


Add @Order(99) to the WebConfigurer class that JHipster generated, 99 or any number < 100.




回答2:


Make sure you don't have dependencies that may collide. In my case the org.activity:spring-boot-starter-rest-api collide with application. After commenting out:

<dependency>
    <groupId>org.activiti</groupId>
    <artifactId>activiti-spring-boot-starter-rest-api</artifactId>
    <version>${activiti.version}</version>
</dependency>

I managed to build my application.




回答3:


Had the same problem, Add @Order(99) on your websecurity class.

@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(prePostEnabled = true)
@EnableAutoConfiguration(exclude = {
        org.activiti.spring.boot.RestApiAutoConfiguration.class,
        org.springframework.boot.autoconfigure.security.SecurityAutoConfiguration.class,
        org.activiti.spring.boot.SecurityAutoConfiguration.class})
@ComponentScan(basePackages = {"com.onlineBankingApplication"})
@Order(99)
public class SecurityConfig extends WebSecurityConfigurerAdapter {



回答4:


Hi I had same issue and I resolved it by just renaming Jhipster genarated class at /web/rest/UserResource.java to /web/rest/UserResourceSomethingElse.java




回答5:


1)

@RestController("JhipsterUserResource")
@RequestMapping("/api")
public class UserResource {

2) JhcommApp.java

import org.activiti.spring.boot.SecurityAutoConfiguration;
@EnableAutoConfiguration(exclude = { SecurityAutoConfiguration.class })

It'll prevent Activiti from adding its own IdentityService to Spring Security.



来源:https://stackoverflow.com/questions/34012786/integrate-activiti-to-jhipster-project

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!