美文网首页
四月二周技术复盘

四月二周技术复盘

作者: 剑道_7ffc | 来源:发表于2020-04-14 11:11 被阅读0次

    idea的get方法修改

    1 set/get生成方法时,不去掉is
    2 链式编程

    设置自定义get方法

    #set($paramName =  $field.name)
    public
    #if($field.modifierStatic)
    static ##
    #end
    
    $field.type ##
    #set($name = $StringUtil.capitalizeWithJavaBeanConvention($StringUtil.sanitizeJavaIdentifier($paramName)))
    get##
    ${name}() {
    return $field.name;
    }
    

    设置自定义set方法

    ###set($paramName =   $helper.getParamName($field, $project))
    #set($paramName =  $field.name)
    public ##
    #if($field.modifierStatic)
    static ##
    #end
    $classname   set$StringUtil.capitalizeWithJavaBeanConvention($paramName)($field.type $paramName) {
    #if ($field.name == $paramName)
        #if (!$field.modifierStatic)
        this.##
        #else
            $classname.##
        #end
    #end
    $field.name = $paramName;
    return this;
    }
    
    public class Student {
        private Boolean isStudent;
        private boolean isStudent1;
        private Integer abc;
    
        public Boolean getIsStudent() {
            return isStudent;
        }
        public Student setIsStudent(Boolean isStudent) {
            this.isStudent = isStudent;
            return this;
        }
        public boolean getIsStudent1() {
            return isStudent1;
        }
        public Student setIsStudent1(boolean isStudent1) {
            this.isStudent1 = isStudent1;
            return this;
        }
        public Integer getAbc() {
            return abc;
        }
        public Student setAbc(Integer abc) {
            this.abc = abc;
            return this;
        }
    }
    

    vm的#set($layout = '')

    layout用来设置默认布局的如layout=''default.vm",set($layout = '')就是把布局设置为空

    vm页面的没有数据和404

    404

    表示vm利用get方法取值时,报异常了

    没有数据

    表示没有获取数据如把pageList错当成list来传递。

    idea 同时编辑多行

    按alt,鼠标往下会形成如下图的垂直线条


    image.png

    idea 自动导入包

    image.png

    mven编译

    maven编译会自动使用tomcat-docker的config下配置文件
    tomcat构建编译时使用resources的配置文件,前提要删除target的目录

    原因

    maven 打包时动态替换properties

    <plugin>
        <groupId>org.apache.maven.plugins</groupId>
        <artifactId>maven-resources-plugin</artifactId>
        <executions>
            <execution>
                <id>copy-resources</id>
                <phase>validate</phase>
                <goals>
                    <goal>copy-resources</goal>
                </goals>
                <configuration>
                    <!-- 指定resources插件处理资源文件到哪个目录下 -->
                    <outputDirectory>${basedir}/target/classes</outputDirectory>
                    <resources>
                        <resource>
                            <!-- 指定resources插件处理哪个目录下的资源文件 -->
                            <directory>tomcat-docker/config</directory>
                            <filtering>true</filtering>
                        </resource>
                    </resources>
                </configuration>
            </execution>
        </executions>
    </plugin> 
    

    相关文章

      网友评论

          本文标题:四月二周技术复盘

          本文链接:https://www.haomeiwen.com/subject/vddzmhtx.html