diff --git a/mybatis-flex-kotlin/pom.xml b/mybatis-flex-kotlin/pom.xml
index ec43b3be..ddfac86d 100755
--- a/mybatis-flex-kotlin/pom.xml
+++ b/mybatis-flex-kotlin/pom.xml
@@ -6,7 +6,7 @@
- * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - *
- * http://www.apache.org/licenses/LICENSE-2.0 - *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-package com.mybatisflex.kotlintest
-
-import com.mybatisflex.core.BaseMapper
-import com.mybatisflex.core.FlexConsts
-import com.mybatisflex.core.audit.AuditManager
-import com.mybatisflex.core.audit.ConsoleMessageCollector
-import com.mybatisflex.kotlin.entry.Entry
-import com.mybatisflex.kotlin.extensions.db.*
-import com.mybatisflex.kotlin.extensions.entry.*
-import com.mybatisflex.kotlin.extensions.mapper.queryList
-import com.mybatisflex.kotlin.extensions.sql.*
-import com.mybatisflex.kotlin.scope.buildBootstrap
-import com.mybatisflex.kotlintest.entry.Account
-import com.mybatisflex.kotlintest.entry.table.AccountTableDef.ACCOUNT
-import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder
-
-import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType
-import javax.sql.DataSource
-import kotlin.streams.toList
-
-
-fun main() {
- val dataSource: DataSource = EmbeddedDatabaseBuilder()
- .setType(EmbeddedDatabaseType.H2)
- .addScript("schema.sql")
- .addScript("data.sql")
- .build()
-
- AuditManager.setAuditEnable(true)
- AuditManager.setMessageCollector(ConsoleMessageCollector())
-
- buildBootstrap {
- + AccountMapper::class.java
- dataSources {
-// dataSource(FlexConsts.NAME,dataSource)
- FlexConsts.NAME of dataSource
-// "dataSource1" of dataSource
-// "dataSource2" of dataSource
- }
-// + dataSource
- }.start()
-
- filter
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.mybatisflex.test
+
+import com.mybatisflex.core.mybatis.FlexConfiguration
+import com.mybatisflex.spring.FlexSqlSessionFactoryBean
+import org.apache.ibatis.logging.stdout.StdOutImpl
+import org.apache.ibatis.session.SqlSessionFactory
+import org.mybatis.spring.SqlSessionFactoryBean
+import org.mybatis.spring.annotation.MapperScan
+import org.springframework.context.annotation.Bean
+import org.springframework.context.annotation.Configuration
+import org.springframework.context.event.ContextStartedEvent
+import org.springframework.context.event.EventListener
+import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder
+import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType
+import javax.sql.DataSource
+
+@Configuration
+@MapperScan("com.mybatisflex.test.mapper")
+open class AppConfig {
+
+
+ @Bean
+ open fun dataSource(): DataSource? {
+ return EmbeddedDatabaseBuilder()
+ .setType(EmbeddedDatabaseType.H2)
+ .addScript("schema.sql")
+ .addScript("data-kt.sql")
+ .build()
+ }
+
+ @Bean
+ open fun sqlSessionFactory(dataSource: DataSource): SqlSessionFactory? {
+ val factoryBean: SqlSessionFactoryBean = FlexSqlSessionFactoryBean()
+ factoryBean.setDataSource(dataSource)
+ val configuration = FlexConfiguration()
+ configuration.logImpl = StdOutImpl::class.java
+ factoryBean.setConfiguration(configuration)
+ return factoryBean.getObject()
+ }
+
+ @EventListener(classes = [ContextStartedEvent::class])
+ open fun handleContextStartedEvent() {
+ println("handleContextStartedEvent listener invoked!")
+ }
+
+
+
+}
+
+
diff --git a/mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/main/kotlin/com/mybatisflex/test/mapper/AccountMapper.kt b/mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/main/kotlin/com/mybatisflex/test/mapper/AccountMapper.kt
new file mode 100755
index 00000000..da9f80d4
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/main/kotlin/com/mybatisflex/test/mapper/AccountMapper.kt
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.mybatisflex.test.mapper
+
+import com.mybatisflex.core.BaseMapper
+import com.mybatisflex.kotlin.extensions.mapper.queryList
+import com.mybatisflex.kotlin.extensions.sql.*
+import com.mybatisflex.test.model.Account
+import com.mybatisflex.test.model.table.AccountTableDef.ACCOUNT
+
+
+@JvmDefaultWithCompatibility
+interface AccountMapper : BaseMapper
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.mybatisflex.test.model
+
+import com.mybatisflex.annotation.SetListener
+
+
+class AccountOnSetListener : SetListener {
+ override fun onSet(entity: Any, property: String, value: Any): Any {
+ println(">>>>>>> property: $property value:$value")
+ return value
+ }
+}
+
diff --git a/mybatis-flex-kotlin/src/test/resources/data.sql b/mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/main/resources/data-kt.sql
similarity index 99%
rename from mybatis-flex-kotlin/src/test/resources/data.sql
rename to mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/main/resources/data-kt.sql
index 228b8319..2ee98fe5 100755
--- a/mybatis-flex-kotlin/src/test/resources/data.sql
+++ b/mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/main/resources/data-kt.sql
@@ -1,4 +1,5 @@
INSERT INTO tb_account
VALUES (1, 'Michael Yang', 18, '2020-01-11');
+
INSERT INTO tb_account
VALUES (2, 'Michael Zhanng', 20, '2020-01-11');
diff --git a/mybatis-flex-kotlin/src/test/resources/mybatis-flex.properties b/mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/main/resources/mybatis-flex.properties
similarity index 72%
rename from mybatis-flex-kotlin/src/test/resources/mybatis-flex.properties
rename to mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/main/resources/mybatis-flex.properties
index b25cdd95..929568bf 100755
--- a/mybatis-flex-kotlin/src/test/resources/mybatis-flex.properties
+++ b/mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/main/resources/mybatis-flex.properties
@@ -1,4 +1,4 @@
processor.mappersGenerateEnable=false
-processor.tablesNameStyle=upCase
+processor.tablesNameStyle=lowerCase
processor.tablesDefSuffix=Def
processor.allInTables=true
diff --git a/mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/main/resources/schema.sql b/mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/main/resources/schema.sql
new file mode 100755
index 00000000..f75d140c
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/main/resources/schema.sql
@@ -0,0 +1,7 @@
+CREATE TABLE IF NOT EXISTS `tb_account`
+(
+ `id` INTEGER ,
+ `u_name` VARCHAR(100) NOT NULL,
+ `age` INTEGER,
+ `birthday` DATETIME
+);
diff --git a/mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/test/kotlin/com/mybatisflex/test/KotlinSpringTest.kt b/mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/test/kotlin/com/mybatisflex/test/KotlinSpringTest.kt
new file mode 100755
index 00000000..1ba41622
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/test/kotlin/com/mybatisflex/test/KotlinSpringTest.kt
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.mybatisflex.test
+
+import com.mybatisflex.test.mapper.AccountMapper
+import org.assertj.core.api.WithAssertions
+import org.junit.runner.RunWith
+
+import org.springframework.beans.factory.annotation.Autowired
+import org.springframework.test.context.ContextConfiguration
+import org.springframework.test.context.junit4.SpringJUnit4ClassRunner
+import kotlin.test.Test
+
+
+@RunWith(SpringJUnit4ClassRunner::class)
+@ContextConfiguration(classes = [AppConfig::class])
+class KotlinSpringTest : WithAssertions {
+ @Autowired
+ lateinit var accountMapper: AccountMapper
+
+ @Test
+ fun testSelectByQuery() {
+ val accounts = accountMapper.findByAge(18,2)
+ accounts.forEach(::println)
+ }
+
+
+}
diff --git a/mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/test/kotlin/com/mybatisflex/test/KotlinTest.kt b/mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/test/kotlin/com/mybatisflex/test/KotlinTest.kt
new file mode 100644
index 00000000..68bf7f2a
--- /dev/null
+++ b/mybatis-flex-test/mybatis-flex-spring-kotlin-test/src/test/kotlin/com/mybatisflex/test/KotlinTest.kt
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2022-2023, Mybatis-Flex (fuhai999@gmail.com).
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package com.mybatisflex.test
+
+import com.mybatisflex.core.FlexConsts
+import com.mybatisflex.core.audit.AuditManager
+import com.mybatisflex.core.audit.ConsoleMessageCollector
+import com.mybatisflex.kotlin.entry.Entry
+import com.mybatisflex.kotlin.extensions.db.filter
+import com.mybatisflex.kotlin.extensions.db.mapper
+import com.mybatisflex.kotlin.extensions.db.query
+import com.mybatisflex.kotlin.extensions.entry.*
+import com.mybatisflex.kotlin.extensions.sql.*
+import com.mybatisflex.kotlin.scope.buildBootstrap
+import com.mybatisflex.test.mapper.AccountMapper
+import com.mybatisflex.test.model.Account
+import com.mybatisflex.test.model.table.AccountTableDef.ACCOUNT
+import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseBuilder
+import org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType
+import javax.sql.DataSource
+import kotlin.streams.toList
+import kotlin.test.Test
+
+
+class KotlinTest {
+ @Test
+ fun testDb() {
+ val dataSource: DataSource = EmbeddedDatabaseBuilder()
+ .setType(EmbeddedDatabaseType.H2)
+ .addScript("schema.sql")
+ .addScript("data-kt.sql")
+ .build()
+
+ AuditManager.setAuditEnable(true)
+ AuditManager.setMessageCollector(ConsoleMessageCollector())
+
+ buildBootstrap {
+ +AccountMapper::class.java
+ dataSources {
+// dataSource(FlexConsts.NAME,dataSource)
+ FlexConsts.NAME of dataSource
+// "dataSource1" of dataSource
+// "dataSource2" of dataSource
+ }
+// + dataSource
+ }.start()
+//
+ ACCOUNT.query