美文网首页
[实习记录]总结陈词

[实习记录]总结陈词

作者: 飞云掣电_iris | 来源:发表于2018-08-23 12:07 被阅读0次

1. docker

  • 日常使用: docker ps\docker inspect\docker images\docker-compose up (-d)\docker pull&push

  • 写docker-compose文件: .env\environment初始化docker\registry.docker-cn.com国内镜像加速\ports\volumes\restart\container_name\depends_on

mongodb:
    image: registry.docker-cn.com/library/mongo
    env_file: docker-compose.env
    ports:
      - 27018:27017
    restart: always
    environment:
      MONGO_INITDB_DATABASE: ${MONGO_INITDB_DATABASE}
      MONGO_INITDB_ROOT_USERNAME: ${MONGO_INITDB_ROOT_USERNAME}
      MONGO_INITDB_ROOT_PASSWORD: ${MONGO_INITDB_ROOT_PASSWORD}
    volumes:
      - /home/kk/data/mongod/datadir:/data/db
    logging:
      driver: json-file
      options:
        max-size: "10"
    container_name: mongodb
  • 写dockerfile: from\label\env\cmd\copy\jar包\docker build -t example .

FROM openjdk:8-jre-alpine
LABEL kk
ENV TZ=Asia/Shanghai
RUN apk add --update --no-cache tzdata && cp /usr/share/zoneinfo/Asia/Shanghai /etc/localtime && echo "Asia/Shanghai" > /etc/timezone
WORKDIR /app
COPY build/libs/example.jar /app/
CMD ["java", "-jar", "-Dspring.profiles.active=prod", "/app/example.jar"]

2. Gradle

buildscript {
    ext {
        springBootVersion = '1.4.2.RELEASE'
        dcm4cheVersion = '5.13.0'
        commonioVersion = '2.6'
        jedisVersion = '2.9.0'
        redisVersion = '1.8.4.RELEASE'
    }
    repositories {
        maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
        maven { url 'http://www.dcm4che.org/maven2/' }
        mavenCentral()
    }
    dependencies {
        classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
    }
}

apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'org.springframework.boot'

jar {
    baseName = 'example'
    version = '1.0.0'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8

repositories {
    maven { url 'http://maven.aliyun.com/nexus/content/groups/public/' }
    maven { url 'http://www.dcm4che.org/maven2/' }
    mavenCentral()
}

dependencies {
    testCompile('org.springframework.boot:spring-boot-starter-test')
    compile("redis.clients:jedis:${jedisVersion}")
    compile("org.springframework.data:spring-data-redis:${redisVersion}")
    compile("org.dcm4che:dcm4che-imageio:${dcm4cheVersion}")
    compile("org.dcm4che:dcm4che-net:${dcm4cheVersion}")
    compile("org.dcm4che.tool:dcm4che-tool-storescu:${dcm4cheVersion}")
    compile("org.dcm4che:dcm4che-core:${dcm4cheVersion}")
    compile("org.dcm4che.tool:dcm4che-tool-common:${dcm4cheVersion}")
    compile("commons-io:commons-io:${commonioVersion}")
    configurations.all {
        exclude module: 'slf4j-log4j12'
    }
}

3.mybatis&JPA: plugin mybatis free

4. flywaydb:ALTER TABLE

5. service&impl: 接口不变只改变底层实现部分

6. @cache&@transactional&@scheduled

    @Transactional(rollbackFor = {DataAccessException.class, DataIntegrityViolationException.class})
        try {
            //TODO
        } catch (DataIntegrityViolationException e) {
            logger.error("[Error] : data integrity error\n " + e);
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return "Failure";
        } catch (DataAccessException e) {
            logger.error("[Error] : database access error\n " + e);
            TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
            return "Failure";
        }
    @CachePut(key = "#label_project.project")
    @Cacheable(key = "#p0")

7.logging&logback

<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">

    <springProperty scope="context" name="log_home" source="tx.data.paths.tmpFileroot"/> 
    <property name="appname" value="DataManageSystem"/>

    <appender name="console" class="ch.qos.logback.core.ConsoleAppender">
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
        </encoder>
    </appender>

    <appender name="file" class="ch.qos.logback.core.rolling.RollingFileAppender">
        <rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
            <fileNamePattern>${log_home}/log/${appname}.%d{yyyy-MM-dd}.log</fileNamePattern>
        </rollingPolicy>
        <encoder>
            <pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern>
        </encoder>
    </appender>

    <root level="WARN">
        <appender-ref ref="console"/>
    </root>

    <logger name="com.infervision" level="INFO">
        <appender-ref ref="file"/>
    </logger>

</configuration>

8. application.yml: spring profiles active

@ConfigurationProperties(prefix = "tx.data.paths") 
@EnableConfigurationProperties(TXDataPaths.class)
spring:
  profiles: prod
  data:
    mongodb:
      uri: mongodb://username:password@localhost:27018/database?authSource=admin
  datasource:
    url: jdbc:mysql://localhost:3307/db_infervision?useUnicode=true&characterEncoding=utf-8
    username: 
    password: 
  redis:
    host: localhost
    port: 6380
logging:
  config: classpath:logback-spring.xml

9. 程序启动前出错,终止程序;程序运行期间出错,保证程序持续运行.

10. spring-data-mongodb:

upsert:
    public Label_Project upsertByDescription(Label_Project label_project) {
        Query query = new Query();
        query.addCriteria(Criteria.where("project").is(label_project.getProject()));
        Update update = new Update();
        update.set("project", label_project.getProject());
        update.set("remark", label_project.getRemark());
        WriteResult result = mongoTemplate.upsert(query, update, Label_Project.class);
        return label_project;
    }
exist不能使用,原因不明.

11. 数据库批量操作

<!--auto generated Code-->
    <insert id="insertList">
        INSERT INTO label_level(
        <include refid="all_column"/>
        )VALUES
        <foreach collection="pojos" item="pojo" index="index" separator=",">
            (
            #{pojo.id},
            #{pojo.type},
            #{pojo.content},
            #{pojo.levelName}
            )
        </foreach>
    </insert>

12. 文件监控:commonio\读取csv文件:commoncsv

13. 对象参数获取返回值:spring-data-mongodb的model不适用(原因不明)

14. .gitignore

15. git:git add\git commit -m\git branch\git checkout\git reset -hard\git merge\git rebase\git pull origin master\arc diff\arc land\

相关文章

  • [实习记录]总结陈词

    1. docker 日常使用: docker ps\docker inspect\docker images\do...

  • 总结陈词

    我很感恩来到这里的近半年时间,虽然发生的事情让我痛苦、抓狂,颠覆我的三观,但是也让我看到了很多不一样的自己。 记得...

  • 总结陈词

    参加齐老师28天的写作营,将于明天落下帷幕。首先感谢群里的几位班委狮子心雨、幸福小玉米、三米无忧,一杯柠7和各位组...

  • 2018总结陈词

    2018是对我很重要的一年。 从小我就是一帮小伙伴里跑步最慢的一个,因为这个小时候没少被别人欺负,而运动的不自信从...

  • 正方总结陈词

    随着社会的不断进步和经济的快速发展,人民的生活水平不断提高,公民的个人财产日益增多,婚前拥有一定房子、车子、票子的...

  • 21# 总结陈词

    普天同庆、喜大普奔的一天,21一天写作的最后一天。在这欢歌笑语的日子里出现了一个噩耗……我得半夜到单位弄设备。哎…...

  • 记录-甜点 关于交流、争论

    (丹叔的总结陈词好精彩,忍不住记录下。) 余杨: 极少有人能够只靠个人的闭门思考,就建立经得起时间考验的思想体系,...

  • 麦豆悦读英文绘本讲师训练营[11期]21/21 绘本赏析总结+展

    1114 张福军 Romas 总结 Finally.......!!!!!!我们终于到了写总结陈词的时候啦!21天...

  • 日常叨叨叨(二)——三四五月总结

    三四五月之总结 序: 马上也要去实习了,在还没找到实习之前我就有打算写一篇文章来记录...

  • 陈小护的实习小总结

    2016.6.14就像奔赴战场般匆匆来到汕尾,开始为期十个月的实习。对于汕尾,说不上喜欢但也不反感。嗯住宿环境还...

网友评论

      本文标题:[实习记录]总结陈词

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