企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
~~~ <?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" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context https://www.springframework.org/schema/context/spring-context.xsd"> <!--指定基础包及子包下 扫描注解--> <context:component-scan base-package="com.nobb"/> <!-- 读取db.properties配置 --> <context:property-placeholder location="classpath:db.properties"/> <!-- 数据源 --> <bean name="dataSource" class="org.springframework.jdbc.datasource.DriverManagerDataSource"> <property name="driverClassName" value="${driverClass}"/> <property name="url" value="${jdbcUrl}"/> <property name="username" value="${user}"/> <property name="password" value="${password}"/> </bean> <!-- sqlSessionFactory,mybatis-config.xml配置可以删除掉 --> <bean name="sessionFactory" class="org.mybatis.spring.SqlSessionFactoryBean"> <property name="dataSource" ref="dataSource"/> <!-- <typeAliases> <package name="com.kaikeba.domain"/> </typeAliases> --> <property name="typeAliasesPackage" value="com.nobb.domain"/> <!-- 指定映射文件所在路径 --> <property name="mapperLocations"> <array> <value>classpath:mappers/*</value> </array> </property> </bean> <!--扫描Mapper接口,生成代理对象,并放入spring容器中 AccountMapper accountMapper = sqlSession.getMapper(AccountMapper.class);--> <bean class="org.mybatis.spring.mapper.MapperScannerConfigurer"> <property name="basePackage" value="com.nobb.mapper"/> </bean> </beans> ~~~