In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Servers >
Share
Shulou(Shulou.com)06/01 Report--
In this issue, the editor will bring you about the implementation of SpringBoot integration Activiti7. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
1. Create a SpringBoot project using IDEA
Introduce related dependencies into the pom.xml file of the project, as follows
4.0.0 org.springframework.boot spring-boot-starter-parent 2.2.1.RELEASE com.example activiti 0.0.1-SNAPSHOT activiti Demo project for Spring Boot UTF-8 UTF-8 1.8 org.springframework.boot spring-boot-starter-jdbc org.springframework.boot spring-boot-starter-web org.springframework.boot spring-boot-starter -test test org.activiti activiti-spring-boot-starter 7.0.0.Beta2 org.mybatis mybatis 3.4.5 mysql mysql-connector-java 5.1.27 org.projectlombok lombok true org.springframework.boot spring-boot-maven-plugin
2.application.yml file configuration
In order to be able to put the tables generated by Activiti7 into the Mysql database, you need to add the relevant configuration to the configuration file application.yml
Server: port: 8085spring: application: name: spring-activiti datasource: url: jdbc:mysql://localhost:3306/activiti?useUnicode=true&characterEncoding=utf8&serverTimezone=GMT&nullCatalogMeansCurrent=true username: root password: 123456 driver-class-name: com.mysql.jdbc.Driver activiti: # 1.flase: default. When activiti starts, it compares the version saved in the database table. If there is no table or the version does not match, an exception is thrown # 2.true: activiti updates all tables in the database. If the table does not exist, automatically create # 3.create_drop: create the table when activiti starts, delete the table when closed (you must manually shut down the engine to delete the table) # 4.drop-create: delete the old table when activiti starts Then when creating a new table (no need to manually shut down the engine) database-schema-update: true # detects the existence of the history table db-history-used: true # record the history level. The history levels that can be configured are none, activity, audit, full history-level: full # to verify the process file. By default, check the process file check-process-definitions: false in the processes folder under resources
3. Add SpringSecurity Security Framework Integration configuration
After the integration of Activiti7 and SpringBoot, the SpringSecurity security framework is integrated by default, so we have to prepare the relevant user rights configuration information integrated by SpringSecurity.
1) add SecurityUtil class
In order to quickly implement the configuration of the SpringSecurity security framework, a component has been added.
@ Componentpublic class SecurityUtil {private Logger logger = LoggerFactory.getLogger (SecurityUtil.class); @ Autowired @ Qualifier ("myUserDetailsService") private UserDetailsService userDetailsService; public void logInAs (String username) {UserDetails user = userDetailsService.loadUserByUsername (username); if (user = = null) {throw new IllegalStateException ("User" + username + "doesn't exist, please provide a valid user");} logger.info ("> Logged in as:" + username) SecurityContextHolder.setContext (new SecurityContextImpl (new Authentication () {@ Override public Collection)
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.