aligungun 2019-05-22 21:01 采纳率: 0%
浏览 2591

spring boot 集成activiti如何能在启动时不配置数据库参数

<?xml version="1.0" encoding="UTF-8"?>
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
4.0.0

org.springframework.boot
spring-boot-starter-parent
1.5.9.RELEASE
<!-- lookup parent from repository -->

com.example
leave
0.0.1-SNAPSHOT
leave
Demo project for Spring Boot


1.8



org.springframework.boot
spring-boot-starter-data-jpa


org.springframework.boot
spring-boot-starter-jdbc



org.springframework.boot
spring-boot-starter-web


mysql
mysql-connector-java
runtime


org.activiti
activiti-spring-boot-starter-basic
6.0.0


org.springframework.boot
spring-boot-starter-tomcat


org.springframework.boot
spring-boot-starter-web-services


org.springframework.boot
spring-boot-starter-test
test





org.springframework.boot
spring-boot-maven-plugin



------上面是spring boot 的pom.xml

在application.properties配置好数据库参数就可以正常运行。我的想法是在程序启动的时候不连接数据库,在程序运行的过程中按需连接到数据库,但我删除了数据可参数的时候就报错了!!!信息如下:

Description:
Cannot determine embedded database driver class for database type NONE
Action:
If you want an embedded database please put a supported one on the classpath. If you have database settings to be loaded from a particular profile you may need to active it (no profiles are currently active).

在网上找到的解决方案是添加注解(分别如下尝试都出错):

1.-------------------------

@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class,HibernateJpaAutoConfiguration.class})

@SpringBootApplication

2.---------------------------------------
@SpringBootApplication(exclude={DataSourceAutoConfiguration.class})

3.------------------------------------
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class,DataSourceTransactionManagerAutoConfiguration.class,HibernateJpaAutoConfiguration.class})

错误信息如下:

Description:
Parameter 0 of method springProcessEngineConfiguration in org.activiti.spring.boot.JpaProcessEngineAutoConfiguration$JpaConfiguration required a bean of type 'javax.sql.DataSource' that could not be found.

  • Bean method 'dataSource' not loaded because @ConditionalOnProperty (spring.datasource.jndi-name) did not find property 'jndi-name'
  • Bean method 'dataSource' not loaded because @ConditionalOnBean (types: org.springframework.boot.jta.XADataSourceWrapper; SearchStrategy: all) did not find any beans

Action:
Consider revisiting the conditions above or defining a bean of type 'javax.sql.DataSource' in your configuration

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥50 MATLAB实现圆柱体容器内球形颗粒堆积
    • ¥15 python如何将动态的多个子列表,拼接后进行集合的交集
    • ¥20 vitis-ai量化基于pytorch框架下的yolov5模型
    • ¥15 如何实现H5在QQ平台上的二次分享卡片效果?
    • ¥15 python爬取bilibili校园招聘网站
    • ¥30 求解达问题(有红包)
    • ¥15 请解包一个pak文件
    • ¥15 不同系统编译兼容问题
    • ¥100 三相直流充电模块对数字电源芯片在物理上它必须具备哪些功能和性能?
    • ¥30 数字电源对DSP芯片的具体要求