我知道以前有人问过这个问题,但我似乎无法理解这件事......
git checkout master
git pull
git git checkout feature
git rebase origin/master
then resolve all the problems....
Try to push - not gonna happen...
Run Code Online (Sandbox Code Playgroud)
git 真的告诉我,在进行了 rebase 之后(处理 n:ths 个冲突)
我有两个选择,使用--force这似乎有风险和愚蠢。
或者pull再次处理合并冲突......并最终处于相同的情况?
error: failed to push some refs to 'ssh://git@git.zzz.com/yyy/xxx.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' …Run Code Online (Sandbox Code Playgroud) 我理解如何收集到一个List,但无法想象我将如何只返回一个过滤对象的参数作为String.
fee = new BigDecimal(fees
.stream()
.filter(p -> p.getTodate().isAfter(LocalDateTime.now()))
.filter(p -> p.getFromdate().isBefore(LocalDateTime.now()))
.filter(p -> p.getId().equals(id))
return fee;
Run Code Online (Sandbox Code Playgroud)
我首先检查费用是否是最新的,因为可能会有即将开始的费用和费用不再有效.然后我将id与剩余费用相匹配.但是最后一次过滤和返回之间缺少代码.
我只想String从Stream对象(p.getFee)返回BigDecimal构造函数.
我知道Stream过滤器后只剩下一个物体.
出于某种原因,我无法解决如何使用流将这个深层嵌套列表转换为新列表的问题.
every A in List<A> contains ->
List<B> where every B contains ->
List<C> where every C contains -> List<String>
Run Code Online (Sandbox Code Playgroud)
我尝试了许多不同的迭代,如:
List<String> newlist = listA.getB()
.stream()
.filter(b -> b.getC()
.stream()
.filter(c -> c.getPeople)
.collect(Collectors.toList())
Run Code Online (Sandbox Code Playgroud)
我充满了困惑......我可以通过for循环轻松完成这项工作,但我听说流简单易用,我想开始更多地使用它们.
我处于一个奇怪的位置,我需要保存@Id一个@Entityasnull
整个项目是使用休眠和实体构建的。但是对于这个遗留实体,表本身有一个触发器来生成 ID。
因此,尝试插入除 null 之外的任何内容都会导致错误。
当尝试.save()使用 null id 的实体时,hibernate 会抛出
org.springframework.orm.jpa.JpaSystemException: ids for this class must be manually assigned before calling save()
Run Code Online (Sandbox Code Playgroud)
编辑:
澄清一下,我需要.save()在 ID 列为空的地方做,因为:
表中的触发器将(在任何插入之前)检查 ID 是否为空,然后执行 SELECT 以获取最后一个 ID 并将其增加 1,最后将此新行插入到表中。如果 ID 不为空,触发器将出错。
我有以下几行
File file = ResourceUtils.getFile("classpath:calculation.csv");
Run Code Online (Sandbox Code Playgroud)
我也尝试过
File file = ResourceUtils.getFile("classpath:/calculation.csv");
Run Code Online (Sandbox Code Playgroud)
但两者都会抛出错误
java.io.FileNotFoundException: class path resource [calculation.csv] cannot be resolved to absolute file path because it does not exist
Run Code Online (Sandbox Code Playgroud)
但我的资源文件夹中有calculation.csv..这是为什么?
我需要从资源文件夹中读取文件,它也应该在服务器环境中工作
编辑:
ClassLoader classLoader = getClass().getClassLoader();
File file = new File(classLoader.getResource("calculation.csv").getFile());
Run Code Online (Sandbox Code Playgroud)
工作得一样好,所以一点也不..
编辑2:尝试使用文件夹..我现在在我的资源文件夹中同时拥有calculation.csv和csv/calculation.csv。
添加了 /csv/ 后,以上都不起作用。
这东西想要走一条什么样的路?!
编辑3:
啊和
File file = new ClassPathResource("calculation.csv").getFile();
Run Code Online (Sandbox Code Playgroud)
也不行,这到底是什么..
我有以下错误:
Parameter 0 of constructor in com.yyy.zzz.xxx.service.ControlService required a bean of type 'com.yyy.zzz.xxx.service.composeXML.ComposeCounterService' that could not be found.
Run Code Online (Sandbox Code Playgroud)
通常这是因为我忘记注释服务或接口,但我整个早上都在查看类,找不到任何丢失的注释。
此时的界面只是:
@Component
public interface ComposeCounterService {
CLASSX init(List<YYY> owners) throws JAXBException;
}
Run Code Online (Sandbox Code Playgroud)
实现服务如下,并且包含 init() 方法(如果在这种情况下很重要)。
@Service
public class ComposeCounterImpl implements ComposeCounterService {
/*** loots of code
}
Run Code Online (Sandbox Code Playgroud)
ApplicationConfig 文件位于服务包的上一级。在这篇文章中标记为xxx。
它包含以下包扫描:
@SpringBootApplication
scanBasePackages = {"com.yyy.zzz.xxx")
Run Code Online (Sandbox Code Playgroud)
我也尝试过扫描数组,例如:
scanBasePackages = {"com.yyy.zzz.xxx", "com.yyy.zzz.xxx.service.composeXML"})
Run Code Online (Sandbox Code Playgroud)
并且在 .service 之后没有 composeXML 这些都不起作用。
我很确定我在这里缺少一些东西,请发送帮助。
编辑:注入风格:
private final ComposeCounterService composeCounterService;
public ControlService(ComposeCounterService composeCounterService) {
this.composeCounterService = composeCounterService;
}
Run Code Online (Sandbox Code Playgroud) java ×5
java-stream ×2
spring ×2
annotations ×1
file ×1
git ×1
hibernate ×1
java-8 ×1
jpa ×1
null ×1
push ×1
rebase ×1
spring-bean ×1
spring-boot ×1