java随笔

tomcat启动警告过多

tomcat启动出现这种情况:
警告 [RMI TCP Connection(3)-127.0.0.1] org.apache.catalina.webresources.Cache.getResource Unable to add the resource at
尝试更换tomcat或者jdk版本。

idea更新maven项目之后,jdk版本被更换成1.5

在maven的配置文件中加上下面的

<profile>
    <id>jdk-1.8</id>
    <activation>
    <activeByDefault>true</activeByDefault>
    <jdk>1.8</jdk>
    </activation>
    <properties>
        <maven.compiler.source>1.8</maven.compiler.source>
        <maven.compiler.target>1.8</maven.compiler.target>
        <maven.compiler.compilerVersion>1.8</maven.compiler.compilerVersion>
    </properties>
</profile>

springboot创建测试类时,无法注入service

#在测试类上方添加以下注解
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = ApplicationInit.class, webEnvironment =SpringBootTest.WebEnvironment.RANDOM_PORT)

toString与(String)的区别

1:toString()方法的对象不能为 null,否则会抛出异常:java.lang.NullPointerException
2:(String)时需确定想要转换值得类型,如果不是String则会报转换失败

windows启动tomcat时一闪而过

编辑tomcat的bin目录下的setclasspath.bat

# 添加JAVA_HOME和JRE_HOME两个环境变量
    SET JAVA_HOME=E:\jdk
    SET JRE_HOME=E:\jdk\jre
posted @ 2020-06-24 21:34  Erosions  阅读(207)  评论(0)    收藏  举报