RaigorJiang opened a new issue #15400:
URL: https://github.com/apache/shardingsphere/issues/15400
## Bug Report
### Which version of ShardingSphere did you use?
sharding-spring-boot-mybatis-example, from master branch
### Expected behavior
execution succeed
### Actual behavior
failed to startup
```
Exception in thread "main" java.lang.IllegalArgumentException: Cannot
instantiate interface org.springframework.context.ApplicationContextInitializer
:
org.springframework.boot.context.ConfigurationWarningsApplicationContextInitializer
at
org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:439)
at
org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:418)
at
org.springframework.boot.SpringApplication.getSpringFactoriesInstances(SpringApplication.java:409)
at
org.springframework.boot.SpringApplication.<init>(SpringApplication.java:259)
at
org.springframework.boot.SpringApplication.<init>(SpringApplication.java:240)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1242)
at
org.springframework.boot.SpringApplication.run(SpringApplication.java:1230)
at
org.apache.shardingsphere.example.sharding.spring.boot.mybatis.ShardingSpringBootMybatisExample.main(ShardingSpringBootMybatisExample.java:37)
Caused by: java.lang.NoSuchMethodError:
org.springframework.core.KotlinDetector.isKotlinReflectPresent()Z
at
org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:191)
at
org.springframework.boot.SpringApplication.createSpringFactoriesInstances(SpringApplication.java:435)
... 7 more
```
### Reason analyze (If you can)
In PR #14883, the dependency on `spring-framework` of example was adjusted:
````
# from
<spring-framework.version>5.0.13.RELEASE</spring-framework.version>
<spring-boot.version>2.0.9.RELEASE</spring-boot.version>
# to
<spring-framework.version>5.2.19.RELEASE</spring-framework.version>
<spring-boot.version>2.0.9.RELEASE</spring-boot.version>
````
Since spring-boot 2.0.9.RELEASE depends on Spring Framework 5.0.13.RELEASE
by default[1], this causes the example to introduce both `spring-core 5.0
0.13.RELEASE` and `spring-core 5.2.19.RELEASE`.
<img width="638" alt="image"
src="https://user-images.githubusercontent.com/5668787/153812590-b1fd09bf-42d3-4707-8ec6-37cde714ef72.png">
Meanwhile, `KotlinDetector` in 5.0.13 does not have a method called
`isKotlinReflectPresent`, it exists in 5.2.19.
### Steps to reproduce the behavior, such as: SQL to execute, sharding rule
configuration, when exception occur etc.
run `ShardingSpringBootMybatisExample`
### Reference
1: https://github.com/spring-projects/spring-boot/releases/tag/v2.0.9.RELEASE
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]