Mybatis Properties (Properties) using

1, write a configuration file (db.properties)

driver=com.mysql.jdbc.Driver
url=jdbc:mysql://localhost:3306/mybatis?
useSSL=false&useUnicode=true&characterEncoding=utf8
username=root
password=123456

Introduced in the core configuration file

 <!--引入外部配置文件-->
    <properties resource="db.properties">
        <property name="username" value="root"/>
        <property name="password" value="123456789"/>
    </properties>
   
  • You can import external files directly
  • In which you can add some attribute configuration
  • If two files have the same field, priority use external configuration files!
Published 29 original articles · won praise 49 · views 1780

Guess you like

Origin blog.csdn.net/qq_41256881/article/details/105362762