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

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条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 求差集那个函数有问题,有无佬可以解决
    • ¥15 【提问】基于Invest的水源涵养
    • ¥20 微信网友居然可以通过vx号找到我绑的手机号
    • ¥15 寻一个支付宝扫码远程授权登录的软件助手app
    • ¥15 解riccati方程组
    • ¥15 display:none;样式在嵌套结构中的已设置了display样式的元素上不起作用?
    • ¥15 使用rabbitMQ 消息队列作为url源进行多线程爬取时,总有几个url没有处理的问题。
    • ¥15 Ubuntu在安装序列比对软件STAR时出现报错如何解决
    • ¥50 树莓派安卓APK系统签名
    • ¥65 汇编语言除法溢出问题