项目问题总结,还有个人简单日记

一、2019年6月18日 上海 中雨

早上打伞走路上班,湿了鞋子,穿了一天,把小风扇放脚下,吹了一天,脚还是像在水里游泳一样,Ha

 1、关于SpringDataJpa的使用注意,如果自己定义了类似BaseRepository这样的公共接口作为其他Model都需继承的DAO层,需要使用@NoRepositoryBean注解,

@NoRepositoryBean
public interface BaseRepository<T,K> extends JpaRepository<T,K>,JpaSpecificationExecutor<T{
}
解释:确保添加了该注解的 repository 接口不会在运行时被创建实例。
也就是说,使用了该注解的接口不会被单独创建实例,只会作为其他接口的父接口而被使用。

2、当数据库与Model实体不对应,有多余字段时,Mysql中有多余Model的字段时,findAll不影响;Model中有多余Mysql的字段时,findAll会报错;

二、2019年6月22日 上海 晴

周六加班……上午打了一会篮球,中午赶到公司加班中,还在加班中(晚饭还没吃,都已经10点了,被一些小问题折腾了)

 1、关于JVM中堆,栈和方法区,常量池的概念,还有在定义接口时,接口参数的传输问题,是 NEW出来的吗?不是的,基于IO写入的。

        String a = new String("a");
        String b = new String("a");
        String a1 = "a";
        String a2 = "a";

        int c = 1;
        int d = 1;
        Integer e = 2;
        Integer f = 2;

       System.out.println(a == b); // false
       System.out.println(c == d); // true
       System.out.println(e == f); // true
       System.out.println(a1 == ""); // false
       System.out.println("****"); // false
       System.out.println(a.equals(b)); // true
       System.out.println(c == d); // true
       System.out.println(e.equals(f)); // true

2、接触Gradle的问题,IDEA构建Gradle项目时遇到的问题,不能导包,或者导报太慢的原因,网上有人建议说要***的问题,这里我的解决方案是:

第一:

第二:添加

添加文件init.gradle,如下,就很快下载了

allprojects{
repositories {
def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
all { ArtifactRepository repo ->
if(repo instanceof MavenArtifactRepository){
def url = repo.url.toString()
if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('http://repo1.maven.org/maven2')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
remove repo
}
if (url.startsWith('https://jcenter.bintray.com/') || url.startsWith('http://jcenter.bintray.com/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
remove repo
}
}
}
maven {
url ALIYUN_REPOSITORY_URL
url ALIYUN_JCENTER_URL
}
}


buildscript{
repositories {
def ALIYUN_REPOSITORY_URL = 'http://maven.aliyun.com/nexus/content/groups/public'
def ALIYUN_JCENTER_URL = 'http://maven.aliyun.com/nexus/content/repositories/jcenter'
all { ArtifactRepository repo ->
if(repo instanceof MavenArtifactRepository){
def url = repo.url.toString()
if (url.startsWith('https://repo1.maven.org/maven2') || url.startsWith('http://repo1.maven.org/maven2')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_REPOSITORY_URL."
remove repo
}
if (url.startsWith('https://jcenter.bintray.com/') || url.startsWith('http://jcenter.bintray.com/')) {
project.logger.lifecycle "Repository ${repo.url} replaced by $ALIYUN_JCENTER_URL."
remove repo
}
}
}
maven {
url ALIYUN_REPOSITORY_URL
url ALIYUN_JCENTER_URL
}
}
}
}