idea中ssm自动配置
自动生成

只需要创建好maven项目,然后创建一个类Test,复制代码粘贴即可

使用注意:

代码
import java.io.*;
public class Test {
    //包名格式
    //列如配置到com.wbg.ssm包下  程序会自动添加dao\controller\service\entity
    private final static String com = "com.wbg.ssm";
    //数据库名称
    private final static String database = "";
    //数据库账号
    private final static String user = "root";
    //数据库密码
    private final static String password = "123456";
    public static void main(String[] args) throws IOException {
        createStart();
    }
    static void createStart() {
        //获取当前项目的路径
        String url = System.getProperty("user.dir");
        System.out.println("开始配置pom.xml");
        System.out.println(configPomXml(url));
        url = url + File.separator + "src" + File.separator + "main";
        System.out.println("开始配置resources目录");
        createResources(url + File.separator + "resources");
        System.out.println("完成配置resources目录");
        System.out.println("开始配置webapp目录");
        createWebapp(url + File.separator + "webapp");
        System.out.println("完成配置webapp目录");
    }
    //***********************Resources************************
    /**
     * 创建四个配置文件
     * dbc.properties
     * log4j.properties
     * mybatis-config.xml
     * spring-web.xml
     *
     * @return
     */
    static boolean createResources(String url) {
        if (createJdbcProperties(url)) {
            System.out.println("jdbc.properties配置成功");
        } else {
            System.out.println("jdbc.properties配置失败");
        }
        if (log4jProperties(url)) {
            System.out.println("log4j.properties配置成功");
        } else {
            System.out.println("log4j.properties配置失败");
        }
        if (mybatisConfig(url)) {
            System.out.println("mybatis-config.xml配置成功");
        } else {
            System.out.println("mybatis-config.xml配置失败");
        }
        if (springWeb(url)) {
            System.out.println("spring-web.xml配置成功");
        } else {
            System.out.println("spring-web.xml配置失败");
        }
        if (generatorConfig(url)) {
            System.out.println("generatorConfig.xml配置成功");
        } else {
            System.out.println("generatorConfig.xml配置失败");
        }
        //\resources\spring
        if (springDao(url + File.separator + "spring")) {
            System.out.println("spring-dao.xml配置成功");
        } else {
            System.out.println("spring-dao.xml配置失败");
        }
        //\resources\spring
        if (springService(url + File.separator + "spring")) {
            System.out.println("spring-service.xml配置成功");
        } else {
            System.out.println("spring-service.xml配置失败");
        }
        return true;
    }
    /**
     * 创建jdbc.properties配置文件
     *
     * @param url 路径
     * @return
     */
    static boolean createJdbcProperties(String url) {
        File file = new File(url, "jdbc.properties");
        String context = "jdbc.driver=org.mariadb.jdbc.Driver\n" +
                "jdbc.url=jdbc:mariadb://localhost:3306/" + database + "\n" +
                "jdbc.user="+user+"\n" +
                "jdbc.password="+password+"";
        return createFile(file, context);
    }
    /**
     * 创建log4j.properties日志文件
     *
     * @param url 路径
     * @return
     */
    static boolean log4jProperties(String url) {
        File file = new File(url, "log4j.properties");
        String context = "# Global logging configuration\n" +
                "log4j.rootLogger=ERROR, ooo\n" +
                "\n" +
                "# MyBatis logging configuration...\n" +
                "log4j.logger." + com + ".dao=DEBUG\n" +
                "\n" +
                "# 规则1,名字为 ooo,向标准输出 System.err/out\n" +
                "log4j.appender.ooo=org.apache.log4j.ConsoleAppender\n" +
                "log4j.appender.ooo.layout=org.apache.log4j.PatternLayout\n" +
                "log4j.appender.ooo.layout.ConversionPattern=%5p [%t] ~ %m%n\n";
        return createFile(file, context);
    }
    /**
     * 创建mybatis-config.xml配置文件
     *
     * @param url 路径
     * @return
     */
    static boolean mybatisConfig(String url) {
        File file = new File(url, "mybatis-config.xml");
        String context = "<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\n" +
                "<!DOCTYPE configuration PUBLIC \"-//mybatis.org//DTD Config 3.0//EN\" \"http://mybatis.org/dtd/mybatis-3-config.dtd\">\n" +
                "\n" +
                "\n" +
                "<configuration>\n" +
                "    <settings>\n" +
                "        <!-- 使用jdbc的getGeneratedKeys获取数据库自增主键值 -->\n" +
                "        <setting name=\"useGeneratedKeys\" value=\"true\" />\n" +
                "        <!-- 使用列别名替换列名 默认:true -->\n" +
                "        <setting name=\"useColumnLabel\" value=\"true\" />\n" +
                "        <!-- 开启驼峰命名转换:Table {create_time} -> Entity {createTime} -->\n" +
                "        <setting name=\"mapUnderscoreToCamelCase\" value=\"true\" />\n" +
                "    </settings>\n" +
                "\n" +
                "    <plugins>\n" +
                "        <plugin interceptor=\"com.github.pagehelper.PageInterceptor\" />\n" +
                "    </plugins>\n" +
                "</configuration>";
        return createFile(file, context);
    }
    /**
     * 创建spring-web.xml配置文件
     *
     * @return
     */
    static boolean springWeb(String url) {
        File file = new File(url, "spring-web.xml");
        String context = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                "<beans xmlns=\"http://www.springframework.org/schema/beans\"\n" +
                "       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
                "       xmlns:context=\"http://www.springframework.org/schema/context\"\n" +
                "       xmlns:mvc=\"http://www.springframework.org/schema/mvc\"\n" +
                "       xsi:schemaLocation=\"http://www.springframework.org/schema/beans\n" +
                "\thttp://www.springframework.org/schema/beans/spring-beans.xsd\n" +
                "\thttp://www.springframework.org/schema/context\n" +
                "\thttp://www.springframework.org/schema/context/spring-context.xsd\n" +
                "\thttp://www.springframework.org/schema/mvc\n" +
                "\thttp://www.springframework.org/schema/mvc/spring-mvc-3.0.xsd\">\n" +
                "    <!-- 配置SpringMVC -->\n" +
                "    <!-- 1.开启SpringMVC注解模式 -->\n" +
                "    <!-- 简化配置:\n" +
                "        (1)自动注册DefaultAnootationHandlerMapping,AnotationMethodHandlerAdapter\n" +
                "        (2)提供一些列:数据绑定,数字和日期的format @NumberFormat, @DateTimeFormat, xml,json默认读写支持\n" +
                "    -->\n" +
                "    <mvc:annotation-driven />\n" +
                "\n" +
                "    <!-- 2.静态资源默认servlet配置\n" +
                "        (1)加入对静态资源的处理:js,gif,png\n" +
                "        (2)允许使用\"/\"做整体映射\n" +
                "     -->\n" +
                "    <mvc:default-servlet-handler/>\n" +
                "\n" +
                "    <!-- 3.配置jsp 显示ViewResolver -->\n" +
                "  <bean class=\"org.springframework.web.servlet.view.InternalResourceViewResolver\">\n" +
                "        <property name=\"viewClass\" value=\"org.springframework.web.servlet.view.JstlView\" />\n" +
                "        <property name=\"prefix\" value=\"/WEB-INF/jsp/\" />\n" +
                "        <property name=\"suffix\" value=\".jsp\" />\n" +
                "    </bean>\n" +
                "    <!-- 4.扫描web相关的bean -->\n" +
                "    <context:component-scan base-package=\"" + com + ".controller\" />\n" +
                "</beans>";
        return createFile(file, context);
    }
    /**
     * 创建spring-dao.xml配置文件
     *
     * @param url 路径
     * @return
     */
    static boolean springDao(String url) {
        File file = new File(url, "spring-dao.xml");
        String context = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                "<beans xmlns=\"http://www.springframework.org/schema/beans\"\n" +
                "       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
                "       xmlns:tx=\"http://www.springframework.org/schema/tx\" xmlns:context=\"http://www.springframework.org/schema/context\"\n" +
                "       xsi:schemaLocation=\"http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd\">\n" +
                "\n" +
                "\n" +
                "\n" +
                "    <!-- 配置整合mybatis过程 -->\n" +
                "    <!-- 1.配置数据库相关参数properties的属性:${url} -->\n" +
                "    <context:property-placeholder location=\"classpath:jdbc.properties\" />\n" +
                "\n" +
                "    <!-- 2.数据库连接池 -->\n" +
                "    <bean id=\"dataSource\" class=\"com.mchange.v2.c3p0.ComboPooledDataSource\">\n" +
                "        <property name=\"driverClass\" value=\"${jdbc.driver}\" />\n" +
                "        <property name=\"jdbcUrl\" value=\"${jdbc.url}\" />\n" +
                "        <property name=\"user\" value=\"${jdbc.username}\" />\n" +
                "        <property name=\"password\" value=\"${jdbc.password}\" />\n" +
                "\n" +
                "        <!-- c3p0连接池的私有属性 -->\n" +
                "        <property name=\"maxPoolSize\" value=\"30\" />\n" +
                "        <property name=\"minPoolSize\" value=\"10\" />\n" +
                "        <!-- 关闭连接后不自动commit -->\n" +
                "        <property name=\"autoCommitOnClose\" value=\"false\" />\n" +
                "        <!-- 获取连接超时时间 -->\n" +
                "        <property name=\"checkoutTimeout\" value=\"10000\" />\n" +
                "        <!-- 当获取连接失败重试次数 -->\n" +
                "        <property name=\"acquireRetryAttempts\" value=\"2\" />\n" +
                "    </bean>\n" +
                "\n" +
                "    <!-- 3.配置SqlSessionFactory对象 -->\n" +
                "    <bean id=\"sqlSessionFactory\" class=\"org.mybatis.spring.SqlSessionFactoryBean\">\n" +
                "        <!-- 注入数据库连接池 -->\n" +
                "        <property name=\"dataSource\" ref=\"dataSource\" />\n" +
                "        <!-- 配置MyBaties全局配置文件:mybatis-config.xml -->\n" +
                "        <property name=\"configLocation\" value=\"classpath:mybatis-config.xml\" />\n" +
                "        <!-- 扫描entity包 使用别名 -->\n" +
                "        <property name=\"typeAliasesPackage\" value=\"" + com + ".entity\" />\n" +
                "        <!-- 扫描sql配置文件:mapper需要的xml文件 -->\n" +
                "        <property name=\"mapperLocations\" value=\"classpath:mapper/*.xml\" />\n" +
                "    </bean>\n" +
                "\n" +
                "    <!-- 4.配置扫描Dao接口包,动态实现Dao接口,注入到spring容器中 -->\n" +
                "    <bean class=\"org.mybatis.spring.mapper.MapperScannerConfigurer\">\n" +
                "        <!-- 注入sqlSessionFactory -->\n" +
                "        <property name=\"sqlSessionFactoryBeanName\" value=\"sqlSessionFactory\" />\n" +
                "        <!-- 给出需要扫描Dao接口包 -->\n" +
                "        <property name=\"basePackage\" value=\"" + com + ".dao\" />\n" +
                "    </bean>\n" +
                "\n" +
                "    <!--配置声明式事务管理-->\n" +
                "    <bean id=\"transactionManager\" class=\"org.springframework.jdbc.datasource.DataSourceTransactionManager\">\n" +
                "        <property name=\"dataSource\" ref=\"dataSource\" />\n" +
                "    </bean>\n" +
                "    <tx:annotation-driven proxy-target-class=\"true\" />\n" +
                "\n" +
                "</beans>";
        return createFile(file, context);
    }
    /**
     * 创建spring-service.xml配置文件
     *
     * @param url 路径
     * @return
     */
    static boolean springService(String url) {
        File file = new File(url, "spring-service.xml");
        String context = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                "<beans xmlns=\"http://www.springframework.org/schema/beans\"\n" +
                "       xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
                "       xmlns:context=\"http://www.springframework.org/schema/context\"\n" +
                "       xmlns:tx=\"http://www.springframework.org/schema/tx\" xmlns:mvc=\"http://www.springframework.org/schema/mvc\"\n" +
                "       xmlns:aop=\"http://www.springframework.org/schema/aop\"\n" +
                "       xsi:schemaLocation=\"http://www.springframework.org/schema/beans\n" +
                "\thttp://www.springframework.org/schema/beans/spring-beans.xsd\n" +
                "\thttp://www.springframework.org/schema/context\n" +
                "\thttp://www.springframework.org/schema/context/spring-context.xsd\n" +
                " http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc.xsd http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop.xsd\">\n" +
                "    <!-- 扫描service包下所有使用注解的类型 -->\n" +
                "    <context:component-scan base-package=\"" + com + ".service\" />\n" +
                "    <mvc:annotation-driven />\n" +
                "    <!-- 启用 aspectj 方式 AOP-->\n" +
                "    <aop:aspectj-autoproxy proxy-target-class=\"true\" />\n" +
                "</beans>";
        return createFile(file, context);
    }
    /**
     * 创建generatorConfig.xml配置文件
     * @param url
     * @return
     */
    static boolean generatorConfig(String url) {
        File file = new File(url, "generatorConfig.xml");
        String context = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                "<!DOCTYPE generatorConfiguration\n" +
                "        PUBLIC \"-//mybatis.org//DTD MyBatis Generator Configuration 1.0//EN\"\n" +
                "        \"http://mybatis.org/dtd/mybatis-generator-config_1_0.dtd\">\n" +
                "\n" +
                "<generatorConfiguration>\n" +
                "\n" +
                "    <context id=\"xxx\" targetRuntime=\"MyBatis3Simple\">\n" +
                "\n" +
                "\n" +
                "        <commentGenerator>\n" +
                "            <property name=\"suppressDate\" value=\"true\" />\n" +
                "        </commentGenerator>\n" +
                "        <!-- 数据库连接 -->\n" +
                "        <jdbcConnection driverClass=\"org.mariadb.jdbc.Driver\"\n" +
                "                        connectionURL=\"jdbc:mariadb://localhost/"+database+"\"\n" +
                "                        userId=\""+user+"\" password=\""+password+"\">\n" +
                "        </jdbcConnection>\n" +
                "\n" +
                "        <!-- Model生成规则 -->\n" +
                "        <javaModelGenerator targetPackage=\""+com+".entity\" targetProject=\"src/main/java\">\n" +
                "            <property name=\"trimStrings\" value=\"true\" />\n" +
                "        </javaModelGenerator>\n" +
                "\n" +
                "        <sqlMapGenerator targetPackage=\"mapper\"  targetProject=\"src/main/resources\"/>\n" +
                "        <!-- dao 规则 -->\n" +
                "        <javaClientGenerator type=\"XMLMAPPER\" targetPackage=\""+com+".dao\"  targetProject=\"src/main/java\">\n" +
                "            <property name=\"enableSubPackages\" value=\"true\" />\n" +
                "        </javaClientGenerator>\n" +
                "        <table tableName=\"%\">\n" +
                "            <generatedKey column=\"id\" sqlStatement=\"Mysql\"/>\n" +
                "        </table>\n" +
                "    </context>\n" +
                "</generatorConfiguration>";
        return createFile(file, context);
    }
    //***********************webapp************************
    static boolean createWebapp(String url) {
        if (webXml(url + File.separator + "WEB-INF")) {
            System.out.println("web.xml配置成功");
        } else {
            System.out.println("web.xml配置失败");
        }
        createCSSJSDirectory(url + File.separator);
        return true;
    }
    /**
     * 创建WEB-INF\web.xml配置文件
     *
     * @param url 路径
     * @return
     */
    static boolean webXml(String url) {
        File file = new File(url, "web.xml");
        String context = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" +
                "<web-app xmlns=\"http://xmlns.jcp.org/xml/ns/javaee\"\n" +
                "         xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\"\n" +
                "         xsi:schemaLocation=\"http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_4_0.xsd\"\n" +
                "         version=\"4.0\">\n" +
                "\n" +
                "    <display-name>自动生成</display-name>\n" +
                "\n" +
                "    <!--解决中文乱码-->\n" +
                "    <filter>\n" +
                "        <filter-name>encodingFilter</filter-name>\n" +
                "        <filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>\n" +
                "        <async-supported>true</async-supported>\n" +
                "        <init-param>\n" +
                "            <param-name>encoding</param-name>\n" +
                "            <param-value>UTF-8</param-value>\n" +
                "        </init-param>\n" +
                "\n" +
                "    </filter>\n" +
                "    <filter-mapping>\n" +
                "        <filter-name>encodingFilter</filter-name>\n" +
                "        <url-pattern>/*</url-pattern>\n" +
                "    </filter-mapping>\n" +
                "\n" +
                "    <!--配置 Spring 的容器-->\n" +
                "    <context-param>\n" +
                "        <param-name>contextConfigLocation</param-name>\n" +
                "        <param-value>classpath:spring/spring-*.xml</param-value>\n" +
                "    </context-param>\n" +
                "    <listener>\n" +
                "        <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>\n" +
                "    </listener>\n" +
                "\n" +
                "    <!--配置 MVC 容器-->\n" +
                "    <!--将所有的请求都交给 Spring MVC 处理-->\n" +
                "    <servlet>\n" +
                "        <servlet-name>app</servlet-name>\n" +
                "        <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>\n" +
                "        <init-param>\n" +
                "            <param-name>contextConfigLocation</param-name>\n" +
                "            <param-value>classpath:spring-web.xml</param-value>\n" +
                "        </init-param>\n" +
                "    </servlet>\n" +
                "    <servlet-mapping>\n" +
                "        <servlet-name>app</servlet-name>\n" +
                "        <url-pattern>/</url-pattern>\n" +
                "    </servlet-mapping>\n" +
                "</web-app>";
        return createFile(file, context);
    }
    /**
     * 创建css和js
     *
     * @param url 路径
     */
    static boolean createCSSJSDirectory(String url) {
        File fcss = new File(url + "css");
        if (fcss.mkdirs()) {
            System.out.println("成功创建css文件夹");
        }
        File fjs = new File(url + "js");
        if (fjs.mkdirs()) {
            System.out.println("成功创建js文件夹");
        }
        return true;
    }
    /**
     * @param file    创建的文件
     * @param context 文件里面的内容
     */
    static boolean createFile(File file, String context) {
        //获取文件
        File parent = file.getParentFile();
        //如果是目录
        if (parent != null) {
            //创建目录
            parent.mkdirs();
        }
        try {
            //创建文件
            file.createNewFile();
            FileWriter fileWriter = null;
            try {
                fileWriter = new FileWriter(file);
                fileWriter.write(context);
                fileWriter.flush();
                fileWriter.close();
            } catch (IOException e) {
                return false;
            }
        } catch (IOException e) {
            System.out.println("创建文件失败:" + e.getMessage());
        }
        return true;
    }
    //***********************pom.xml************************
    /**
     * 配置pom.xml文件
     *
     * @param url 路径
     */
    static String configPomXml(String url) {
        File file = new File(url, "pom.xml");
        InputStream inputStream = null;
        byte b[] = new byte[Integer.parseInt(String.valueOf(file.length()))];
        StringBuffer stringBuffer = null;
        try {
            inputStream = new FileInputStream(file);
            inputStream.read(b);
            inputStream.close();
            stringBuffer = new StringBuffer(new String(b));
            stringBuffer.replace(Integer.parseInt(String.valueOf(file.length())) - 10, Integer.parseInt(String.valueOf(file.length())), "");
            stringBuffer.append(pomContext());
        } catch (Exception e) {
            return "程序出错,请重试 -- pom.xml文件配置失败";
        }
        if (createFile(file, stringBuffer.toString())) {
            return "pom.xml文件配置完成";
        }
        return "pom.xml文件配置失败";
    }
    /**
     * pom.xml配置文件需要加的配置
     *
     * @return
     */
    static String pomContext() {
        return "<!--打包-->\n" +
                "    <packaging>war</packaging>\n" +
                "    <!--设置编码-->\n" +
                "    <properties>\n" +
                "        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>\n" +
                "        <maven.compiler.source>1.8</maven.compiler.source>\n" +
                "        <maven.compiler.target>1.8</maven.compiler.target>\n" +
                "        <spring.version>5.1.0.RELEASE</spring.version>\n" +
                "    </properties>\n" +
                "    <!--引入文件-->\n" +
                "    <dependencies>\n" +
                "        <!-- Spring Web MVC -->\n" +
                "        <dependency>\n" +
                "            <groupId>org.springframework</groupId>\n" +
                "            <artifactId>spring-web</artifactId>\n" +
                "            <version>${spring.version}</version>\n" +
                "        </dependency>\n" +
                "        <dependency>\n" +
                "            <groupId>org.springframework</groupId>\n" +
                "            <artifactId>spring-webmvc</artifactId>\n" +
                "            <version>${spring.version}</version>\n" +
                "        </dependency>\n" +
                "\n" +
                "        <!-- servlet 系列的支持 -->\n" +
                "        <dependency>\n" +
                "            <groupId>javax</groupId>\n" +
                "            <artifactId>javaee-api</artifactId>\n" +
                "            <version>8.0</version>\n" +
                "            <scope>provided</scope>\n" +
                "        </dependency>\n" +
                "        <dependency>\n" +
                "            <groupId>javax.servlet</groupId>\n" +
                "            <artifactId>jstl</artifactId>\n" +
                "            <version>1.2</version>\n" +
                "        </dependency>\n" +
                "\n" +
                "        <dependency>\n" +
                "            <groupId>com.github.pagehelper</groupId>\n" +
                "            <artifactId>pagehelper</artifactId>\n" +
                "            <version>5.1.7</version>\n" +
                "        </dependency>\n" +
                "\n" +
                "        <!-- Springframework -->\n" +
                "        <dependency>\n" +
                "            <groupId>org.springframework</groupId>\n" +
                "            <artifactId>spring-context</artifactId>\n" +
                "            <version>${spring.version}</version>\n" +
                "        </dependency>\n" +
                "        <dependency>\n" +
                "            <groupId>org.springframework</groupId>\n" +
                "            <artifactId>spring-jdbc</artifactId>\n" +
                "            <version>${spring.version}</version>\n" +
                "        </dependency>\n" +
                "        <dependency>\n" +
                "            <groupId>org.springframework</groupId>\n" +
                "            <artifactId>spring-aop</artifactId>\n" +
                "            <version>${spring.version}</version>\n" +
                "        </dependency>\n" +
                "        <dependency>\n" +
                "            <groupId>org.aspectj</groupId>\n" +
                "            <artifactId>aspectjweaver</artifactId>\n" +
                "            <version>1.9.1</version>\n" +
                "        </dependency>\n" +
                "\n" +
                "        <!-- MyBatis -->\n" +
                "        <dependency>\n" +
                "            <groupId>org.mybatis</groupId>\n" +
                "            <artifactId>mybatis</artifactId>\n" +
                "            <version>3.4.6</version>\n" +
                "        </dependency>\n" +
                "        <dependency>\n" +
                "            <groupId>org.mybatis</groupId>\n" +
                "            <artifactId>mybatis-spring</artifactId>\n" +
                "            <version>1.3.2</version>\n" +
                "        </dependency>\n" +
                "\n" +
                "        <!-- 数据库驱动以及数据库连接池-->\n" +
                "        <dependency>\n" +
                "            <groupId>org.mariadb.jdbc</groupId>\n" +
                "            <artifactId>mariadb-java-client</artifactId>\n" +
                "            <version>2.3.0</version>\n" +
                "        </dependency>\n" +
                "        <dependency>\n" +
                "            <groupId>com.mchange</groupId>\n" +
                "            <artifactId>c3p0</artifactId>\n" +
                "            <version>0.9.5.2</version>\n" +
                "        </dependency>\n" +
                "\n" +
                "        <!-- 日志框架 -->\n" +
                "        <dependency>\n" +
                "            <groupId>log4j</groupId>\n" +
                "            <artifactId>log4j</artifactId>\n" +
                "            <version>1.2.17</version>\n" +
                "        </dependency>\n" +
                "\n" +
                "        <!-- 通用工具 -->\n" +
                "        <dependency>\n" +
                "            <groupId>com.fasterxml.jackson.core</groupId>\n" +
                "            <artifactId>jackson-databind</artifactId>\n" +
                "            <version>2.9.7</version>\n" +
                "        </dependency>\n" +
                "\n" +
                "        <!-- 单元测试 -->\n" +
                "        <dependency>\n" +
                "            <groupId>org.springframework</groupId>\n" +
                "            <artifactId>spring-test</artifactId>\n" +
                "            <version>${spring.version}</version>\n" +
                "            <scope>test</scope>\n" +
                "        </dependency>\n" +
                "\n" +
                "        <dependency>\n" +
                "            <groupId>junit</groupId>\n" +
                "            <artifactId>junit</artifactId>\n" +
                "            <version>4.12</version>\n" +
                "            <scope>test</scope>\n" +
                "        </dependency>\n" +
                "    </dependencies>\n" +
                "    <build>\n" +
                "        <finalName>contact</finalName>\n" +
                "        <plugins>\n" +
                "            <plugin>\n" +
                "                <groupId>org.mybatis.generator</groupId>\n" +
                "                <artifactId>mybatis-generator-maven-plugin</artifactId>\n" +
                "                <version>1.3.7</version>\n" +
                "                <dependencies>\n" +
                "                    <dependency>\n" +
                "                        <groupId>org.mariadb.jdbc</groupId>\n" +
                "                        <artifactId>mariadb-java-client</artifactId>\n" +
                "                        <version>2.3.0</version>\n" +
                "                    </dependency>\n" +
                "                </dependencies>\n" +
                "            </plugin>\n" +
                "        </plugins>\n" +
                "\n" +
                "        <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) -->\n" +
                "            <plugins>\n" +
                "                <plugin>\n" +
                "                    <artifactId>maven-clean-plugin</artifactId>\n" +
                "                    <version>3.0.0</version>\n" +
                "                </plugin>\n" +
                "                <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging -->\n" +
                "                <plugin>\n" +
                "                    <artifactId>maven-resources-plugin</artifactId>\n" +
                "                    <version>3.0.2</version>\n" +
                "                </plugin>\n" +
                "                <plugin>\n" +
                "                    <artifactId>maven-compiler-plugin</artifactId>\n" +
                "                    <version>3.7.0</version>\n" +
                "                </plugin>\n" +
                "                <plugin>\n" +
                "                    <artifactId>maven-surefire-plugin</artifactId>\n" +
                "                    <version>2.20.1</version>\n" +
                "                </plugin>\n" +
                "                <plugin>\n" +
                "                    <artifactId>maven-war-plugin</artifactId>\n" +
                "                    <version>3.2.0</version>\n" +
                "                </plugin>\n" +
                "                <plugin>\n" +
                "                    <artifactId>maven-install-plugin</artifactId>\n" +
                "                    <version>2.5.2</version>\n" +
                "                </plugin>\n" +
                "                <plugin>\n" +
                "                    <artifactId>maven-deploy-plugin</artifactId>\n" +
                "                    <version>2.8.2</version>\n" +
                "                </plugin>\n" +
                "            </plugins>\n" +
                "        </pluginManagement>\n" +
                "    </build>\n\n" +
                "</project>";
    }
}
运行后

idea中ssm自动配置的更多相关文章
- 头秃了,Spring Boot 自动配置了解一波~
		
持续原创输出,点击上方蓝字关注我 目录 前言 源码版本 @SpringBootApplication干了什么? @EnableAutoConfiguration干了什么? 总结 前言 为什么Sprin ...
 - spring boot实战(第十三篇)自动配置原理分析
		
前言 spring Boot中引入了自动配置,让开发者利用起来更加的简便.快捷,本篇讲利用RabbitMQ的自动配置为例讲分析下Spring Boot中的自动配置原理. 在上一篇末尾讲述了Spring ...
 - SpringBoot 源码解析 (五)----- Spring Boot的核心能力 - 自动配置源码解析
		
在上一篇博客中分析了springBoot启动流程,大体的轮廓只是冰山一角.今天就来看一下springBoot的亮点功能:自动化装配功能. 先从@SpringBootApplication开始.在启动流 ...
 - springboot mvc自动配置(目录)
		
对于长时间基于spring框架做web开发的我们,springmvc几乎成为了开发普通web项目的标配.本系列文章基于快速启动的springboot,将从源码角度一点点了解springboot中mvc ...
 - 我是如何做到springboot自动配置原理解析
		
一前言 springboot 2.0.0版本分析,整体的自动配置流程如下: 具体配置参考官方文档:springboot-doc 二 @SpringBootApplication 核心注解@Spring ...
 - Spring Boot2 系列教程(二十一) | 自动配置原理
		
微信公众号:一个优秀的废人.如有问题,请后台留言,反正我也不会听. 前言 这个月过去两天了,这篇文章才跟大家见面,最近比较累,大家见谅下.下班后闲着无聊看了下 SpringBoot 中的自动配置,把我 ...
 - Springboot学习:底层依赖与自动配置的原理
		
springboot依赖的父项目 我们在创建springboot项目的时候,设置了一个父项目: 这个项目可以点进去,可以发现它依赖于另一个父项目 再次点进去,发现没有依赖父项目了 观察这个项目的pom ...
 - 面试题: SpringBoot 的自动配置原理
		
个人博客网:https://wushaopei.github.io/ (你想要这里多有) 3.Spring Boot 的自动配置原理 package com.mmall; import org. ...
 - Spring Boot面试杀手锏————自动配置原理
		
转:https://blog.csdn.net/u014745069/article/details/83820511 引言不论在工作中,亦或是求职面试,Spring Boot已经成为我们必知必会的技 ...
 
随机推荐
- 简单的CRUD(二)
			
一.重构简单的CRUD 1.JDBC工具类 1.因为在crud中都包含一些相同的代码所以可以提取出来,抽取代码重构为工具类. 2.将工具类设置为static静态类,方便调用,不需要new对象. pub ...
 - javaweb之EL自定义函数
			
1.什么是EL自定义函数 EL自定义函数是在EL表达式中调用的某个java类的静态方法,这个静态方法需在web应用程序中进行配置才可以被EL表达式调用.EL自定义函数可以扩展EL表达式的功能,让EL表 ...
 - 如何将一个SpringBoot简便地打成一个war包(转)
			
为什么要把SpringBoot打成war包 正常情况下SpringBoot项目是以jar包的形式,通过命令行: java -jar demo.jar 来运行的,并且SpringBoot是内嵌Tomca ...
 - curl POST JSON
			
1. 场景 Controller接收json格式数据 封装bean @RequestMapping(value = "/bb", method = RequestMethod.PO ...
 - cf1043C. Smallest Word(贪心)
			
题意 题目链接 Sol 这题打cf的时候真的是脑残,自己造了个abcdad的数据开心的玩了半天一脸懵逼...最后还好ycr大佬给了个思路不然就凉透了... 首先不难看出我们最后一定可以把字符串弄成\( ...
 - IDEA 自动生成serialVersionUID
			
场景:刚转到用IDEA,因为需要生成serialVersionUID,并没有自动生成. 转自:http://blog.csdn.net/liuzongl2012/article/details/451 ...
 - mui.ajax()和asp.net  sql服务器数据交互【1】
			
简单的ajax和asp.net的交互,例如遍历数据,前端显示复杂内容没有添加代码,可自行研究!非常适合懂那么一点点的我们! 实现步骤: 1.APP前端HTML: <div class=" ...
 - C#打印代码运行时间
			
使用以下方法可以准确的记录代码运行的耗时. System.Diagnostics.Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); / ...
 - 最长公共子序列(LCS)思维导图
 - redis 存取问题
			
今天在写短信接口时候,要把验证码存到缓存里面.因为之前别人已经写的有案例,按照之前写的,获取 值.存到数据库,存到redis. 因为有过期时间,需要传过期时间.但是怎么都是不出来... 源码: @Ov ...