springboot

1、idea开发热部署依赖增加方法,点击

2、服务启动后正常,但是无法上线,一直处于down状态,https://www.cnblogs.com/lodor/p/7849967.html 

我是application中的redis没有设置可用的服务导致eureka中一直显示down;

3、使用mvn package进行打包后,运行应用出现swagger的index.html没有被打包到应用jar中;解决方法,加了以下标红的设置;

<build>
		
		<plugins>
			<plugin>
				<groupId>org.springframework.boot</groupId>
				<artifactId>spring-boot-maven-plugin</artifactId>
			</plugin>
		</plugins>
		<resources>
			<resource>
				<directory>src/main/java</directory>
				<includes>
					<include>**/*.xml</include>
				</includes>
			</resource>
			<resource>				        
                          <directory>${project.basedir}/src/main/resources</directory>
			</resource>
		</resources>
	</build>

4、

springcloud应用中子应用,其他的入参数需要在一个参数中使用json格式传入时,设置该入参的dataType为json; 

            @ApiImplicitParam(name = "sendData", value = "参数json", required = true, dataType = "JSON", paramType = "body"),
            @ApiImplicitParam(name = "token", value = "XX", required = false, dataType = "String", paramType = "query")

5、单元测试

https://www.jianshu.com/p/813fd69aabee

 

6、spring webmvc中Interceptor

https://www.bbsmax.com/A/E35p233Ezv/

https://www.logicbig.com/how-to/code-snippets/jcode-spring-mvc-asynchandlerinterceptor.html

 

 

7、https://segmentfault.com/blog/spring5mvc 

 

2019-11-27

今晚在服务器启动springboot v2.0.4应用:

java  -Dspring.config.location=D:\config\config.properties -Dspring.profiles.active=consumer,prod -jar springbootrestdemo-0.0.1-SNAPSHOT.jar 

通过这个方式,可用指定多个配置参数,同时可用使得@Profile注解中指定的对应多个值的程序生效;

 

2020-01-03

SimplejdbcCall调用存储过程

    private Integer callProcedure(String positionId,Long projectId) {

        Integer exeResult = 0;
        SqlParameterSource in = new MapSqlParameterSource()
                .addValue("position_ids", positionId).addValue("project_id",projectId);
        SimpleJdbcCall funcSaveProjectItemByPositionIds = new SimpleJdbcCall(jdbcTemplate)
                .withProcedureName("saveProjectItemByPositionIds");
        Map out   = funcSaveProjectItemByPositionIds.execute(in);

        if (out.get("exe_result") != null ) {
            exeResult = (int)out.get("exe_result");
        }

        log.debug("callProcedure****************exeResult    " + exeResult);
        log.debug("callProcedure****************tmpResult    " + out.get("exe_result"));


        return exeResult;

    }

 

spring的事件通知机制;  

 

spring资料:

《spring实战》

https://potoyang.gitbook.io/spring-in-action-v5/di-1-zhang-spring-ru-men

 

springboot中设置servlet上传文件大小限制

 

posted @ 2019-09-13 15:09  zhucezmf  阅读(182)  评论(0)    收藏  举报