service生命周期
//loadOnStartup默认值是-1,0或者正整数,服务器创建时启动serblet对象,数字越小优先级越高 package DemoServlet; import javax.jws.WebService; import javax.servlet.*; import javax.servlet.annotation.WebServlet; import java.io.IOExceptio...
//loadOnStartup默认值是-1,0或者正整数,服务器创建时启动serblet对象,数字越小优先级越高 package DemoServlet; import javax.jws.WebService; import javax.servlet.*; import javax.servlet.annotation.WebServlet; import java.io.IOExceptio...
<plugins> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration>...
<delete id=”del”> <!–删除一个 DELETE FROM tb_brand where id = #{id};–> DELETE FROM tb_brand where id in <foreach collection=”array” item=”id” separator=”,” open=”(” close=”)”> #{id} &l...
多条件查询 第一种方法: <select id=”dim” resultType=”DimDyl.Demo05.Dio”> select * from tb_brand where 1 = 1 <if test=”id != null”> and id = #{id} </if> <if test=”Pp_ename != null and Pp_enam...
<select id=”dim” resultType=”DimDyl.Demo05.Dio”> select * from tb_brand where id = #{id} and Pp_ename like #{Pp_ename} and Qy_ename like #{Qy_ename}; </select> //散装参数 //List<Dio> dim...
//加载mybatis核心文件 String resoures = “mybatis-config.xml”; InputStream resourceAsStream = Resources.getResourceAsStream(resoures); SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(...
<!–别名–> <typeAliases> <package name=”DimDyl.Dim”/> </typeAliases>
//加载mybatis核心文件 String resoures = “mybatis-config.xml”; InputStream resourceAsStream = Resources.getResourceAsStream(resoures); SqlSessionFactory sessionFactory = new SqlSessionFactoryBuilder().build(...
//加载mybatis核心文件,获取SqlSessionFactory String resource = “mybatis-config.xml”; InputStream inputStream = Resources.getResourceAsStream(resource); SqlSessionFactory sqlSessionFactory = new SqlSessionFacto...
Maven查找包:https://mvnrepository.com/ 多个导入项目只能在一个dependencies中创建,不然会报错 <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version...
配置阿里云仓库 //settings.xml <mirror> <id>alimaven</id> <name>aliyun maven</name> <url>http://maven.aliyun.com/nexus/content/groups/public</url> <mirrorOf>cen...
//获取连接 String url = “jdbc:mysql:///xuexi”; String user = “root”; String passwd = “123321”; Connection cnt = DriverManager.getConnection(url, user, passwd); //加载配置文件 Properties prop = new Properties();...
driverClassName=com.mysql.cj.jdbc.Driver #URL连接数据库的URL,其中travel(以下面例子来说)为连接的数据库,后面的参数可不改但不删 url=jdbc:mysql://localhost:3306/travel?useSSL=false&allowPublicKeyRetrieval=true&serverTimezone=UTC ...
String url = “jdbc:mysql:///xuexi”; String user = “root”; String passwd = “123321”; Connection connection = DriverManager.getConnection(url, user, passwd); Statement statement = connection.createState...
public static void main(String[] args) throws Exception{ dim(); } public static void dim() throws Exception{ String url = “jdbc:mysql:///xuexi”; String user = “root”; String passwd = “123321”; Connect...
//获取连接 String url = “jdbc:mysql:///xuexi”; String user = “root”; String passwd = “123321”; Connection connection = DriverManager.getConnection(url,user,passwd); Statement statement = connection.create...
import java.sql.Connection; import java.sql.DriverManager; import java.sql.Statement; public class Mian { public static void main(String[] args) throws Exception{ //注册驱动 //Class.forName(“com.mysql.jdb...