Comments (5)
jdbcurl 怎么配置的?
from pagehelper-spring-boot.
不引入starter包 把PageHelperAutoConfiguration这个类的代码拷贝出来,注释掉@ConditionalOnBean(SqlSessionFactory.class) 就不报错了,不知道什么原因
`@Configuration
//@ConditionalOnBean(SqlSessionFactory.class)
@EnableConfigurationProperties(PageHelperProperties.class)
public class PageHelperAutoConfig{
@Autowired
private List<SqlSessionFactory> sqlSessionFactoryList;
@Autowired
private PageHelperProperties properties;
/**
* 接受分页插件额外的属性
*
*/
@Bean
@ConfigurationProperties(prefix = PageHelperProperties.PAGEHELPER_PREFIX)
public Properties pageHelperProperties() {
return new Properties();
}
@PostConstruct
public void addPageInterceptor() {
PageInterceptor interceptor = new PageInterceptor();
Properties properties = new Properties();
//先把一般方式配置的属性放进去
properties.putAll(pageHelperProperties());
//在把特殊配置放进去,由于close-conn 利用上面方式时,属性名就是 close-conn 而不是 closeConn,所以需要额外的一步
properties.putAll(this.properties.getProperties());
interceptor.setProperties(properties);
for (SqlSessionFactory sqlSessionFactory : sqlSessionFactoryList) {
sqlSessionFactory.getConfiguration().addInterceptor(interceptor);
}
}
}`
from pagehelper-spring-boot.
这种情况只能针对代码调试找原因了。
from pagehelper-spring-boot.
我也碰到这个问题了,我用的是sharding sphere。在application.yml中并没有配置spring.datasource,配置的是spring.shardingsphere.datasource。//@ConditionalOnBean(SqlSessionFactory.class)就行了
from pagehelper-spring-boot.
如果是自定义的 datasource (例如使用mycat) 并且是自己写的datasource AutoConfig
没用 pagehelper-spring-boot-start时 正常使用。
引入start后,会报如下错误,怎么破?APPLICATION FAILED TO START
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
其实是Configuration加载顺序的问题,你自己定义的starter中的Configuration加载在PageHepler的Configuration之后了,造成了SpringBoot先加载了自己的DS 的Configuration,所以报错。在你自己的Configuration中加上@AutoConfigureBefore(DataSourceAutoConfiguration.class)这个就OK了。
from pagehelper-spring-boot.
Related Issues (20)
- 在项目中使用热部署,starter中的PageHelperAutoConfiguration会重复添加PageInterceptor
- pom依赖冲突
- 会出现rows有数据但是total的数量等于0的情况 HOT 4
- 大数据量时查询效率的问题
- spring boot3 启动有警告
- pageNum超出totalPages,分页总是返回最后一页的数据 HOT 1
- 依赖引不进来 HOT 2
- 1.4.7依赖有问题 HOT 3
- 关于分页时联表查询count会统计全部行数, 而不是左表行数. HOT 3
- GBase分页会自动把库表连接符冒号:替换成点号. HOT 2
- 通过pagehelper实现较个性化的分页需求 HOT 2
- 第三方依赖建议添加<optional>true</optional> HOT 1
- intellij idea警告try-with-resources HOT 1
- springboot使用1.4.7版本后启动报错 HOT 1
- startPage的orderBy存在字段重复排序问题
- setOrderBy(param.getOrderBy())里面的参数驼峰可以自动转换为下划线吗 HOT 2
- 支持mybatis-plus吗 HOT 4
- 今天从pagehelper.version 1.4.7 升级到 pagehelper.version2.1.0 出现的问题 HOT 9
- 大佬,请问什么时候适配spring boot 3.2呢? HOT 6
- 升级到最新版本后出现PageHelperAutoConfiguration Bad return type HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pagehelper-spring-boot.