NoSuchBeanDefinitionException:未定义类型为[javax.activation.DataSource]的唯一bean:应为单个bean,但找到0:

NoSuchBeanDefinitionException:未定义类型为[javax.activation.DataSource]的唯一bean:应为单个bean,但找到0:,java,spring,spring-mvc,Java,Spring,Spring Mvc,我无法连接到数据库mysql 我在Windows864上使用带有xampp的spring工具套件和phpMyAdmin 这是我的例外: Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.activation.DataSource] is defined: expected single bean but

我无法连接到数据库mysql 我在Windows864上使用带有xampp的spring工具套件和phpMyAdmin

这是我的例外:

Exception in thread "main" org.springframework.beans.factory.NoSuchBeanDefinitionException: No unique bean of type [javax.activation.DataSource] is defined: expected single bean but found 0: 
at org.springframework.beans.factory.support.DefaultListableBeanFactory.getBean(DefaultListableBeanFactory.java:271)
at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1083)
at pl.bnsmedia.tasks.Runner.main(Runner.java:32)
我在app-context.xml上的配置

<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:p="http://www.springframework.org/schema/p"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">

<description>Example configuration to get you started.</description>

<context:component-scan base-package="pl.bnsmedia.tasks" />
<context:property-placeholder location="classpath:META-INF/spring/service-config.properties"/>

<bean id="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"
p:url="jdbc:mysql://localhost:3306/taskManager"
p:driverClassName="com.mysql.jdbc.Driver"
p:username="root"
p:password="sokol"

/>
在我遇到异常情况后,请帮助我这样做:

javax.sql.DataSource dataSource = context.getBean(javax.sql.DataSource.class);
您使用了错误的数据源:异常显示为javax.activation.datasource。

按如下方式操作:

javax.sql.DataSource dataSource = context.getBean(javax.sql.DataSource.class);
您使用了错误的数据源:异常为javax.activation.datasource