Spring
Spring
爱花的蛋
我是一个努力的辣鸡
展开
-
@JsonFormat
@JsonFormat给po中增加上这个玩意@JsonFormat(“yyyy-MM-dd HH:mm:ss”)会在controller序列化返回的时候调整Date的toString方式Fri Sep 24 10 : 47 : 00 CST 2021转换成yyyy-MM-dd HH:mm:ss如果使用后不能正常封装数据,返回数据为时间戳的格式。这样方式无法正常使用封装数据@JsonFormat(pattern = “yyyy-MM-dd”)private Date acceptTime;解决办原创 2021-09-24 18:05:19 · 334 阅读 · 0 评论 -
SpringBoot的refresh()中Onfresh()为空?
SpringBoot的onRefresh()方法// Initialize other special beans in specific context subclasses.如图,这是Spring的Onfresh()方法,为空就是为了就让需要用的工程自己去实现!refresh()方法中需要指定this,当没有项目启动的时候,直接点进去看,是看Spring自己的onRefresh()方法,为空当使启动SpringBoot的时候,用debug点进去(F7),进入的是SpringBoot的jar包原创 2020-09-17 21:43:00 · 683 阅读 · 0 评论 -
controller没扫描到为什么却能用
没扫描到的情况如图贼迷糊,怎么看都不知道为啥,多模快没扫描到是因为我改了starter的pom.xml,改了依赖。这个是为啥呢,咋都不知道。一直到想着要不来个三步走吧,rebuild,clean,invalidate caches/restart。结果clean的时候发现报了error,哦吼,有戏看了。看了一下自己的maven配置,发现是以前自己更改过的配置文件setting1.xml,后来改成了setting.xml这个项目的配置却没有改。当当当,当当当,醒醒,别吹牛逼了,错的没边都,注解也没用对原创 2020-09-16 13:58:07 · 507 阅读 · 0 评论 -
使用Idea创建Spring MVC应用程序
文章1:https://blog.csdn.net/weixin_42518668/article/details/103594144文章2:https://www.cnblogs.com/wormday/p/8435617.html原创 2020-09-03 14:51:10 · 138 阅读 · 0 评论 -
使用java导Mysql的.sql文件,扩展->mysqldump命令的使用,mysql使用SQL语句查询comment注释
使用java实现导出导入数据库的sql文件https://blog.csdn.net/qq_39641912/article/details/79692284#commentBox重点:创建runtime调用方法执行exec(command),然后能够使用cmd命令导出文件Runtime runtime = Runtime.getRuntime();String command = new String("cmd /k mysqldump -u"+user+" -p"+password+" "+ex原创 2020-09-01 21:35:32 · 371 阅读 · 0 评论 -
Spring中注解的key值相同报错conflicts with existing, non-compatible bean definition of same name and class
文章来自:https://blog.csdn.net/zhongguowangzhan/article/details/104587803SpringMVC的Controller 应该是采用类似键值对(key/value)的映射方式处理的。而当中的键,默认是用cotroller的类名(非全类名)作为键。这样,如果不同包下面的两个Contoller 重名的话,就会导致SpringMVC的容器管理中的controller map中的key重复了。解决这个问题也比较简单。在@Controller 中,使用重原创 2020-09-01 21:32:14 · 489 阅读 · 0 评论 -
Initialization failed for ‘https://start.spring.io‘ Please check URL, network and proxy settings解决办法
如下https://blog.csdn.net/qq_42815122/article/details/85551956原创 2020-08-28 17:35:38 · 150 阅读 · 0 评论 -
在测试单元/类中不能使用自动装配
在测试单元/类中不能使用自动装配(@Autowired)测试类通常采用Junit测试,与tomcat无关,是两个运行环境,采用注解的时候对于SSM,需要加上注解spring配置文件和启动类@RunWith(SpringJUnit4ClassRunner.class)@ContextConfiguration("/springMVC.xml") 对于SpringBoot:需要加上注解表明SpringBoot的测试,加上启动类@SpringBootTest@RunWith(SpringRu原创 2020-08-08 17:29:06 · 1667 阅读 · 1 评论
分享