我有以下枚举和映射:
typedef enum {
MaxX = 0,
MaxY,
MaxCells,
MaxCycles,
Threes
} SettingName;
typedef std::map<SettingName, const char*> SettingNameCollection;
SettingNameCollection settingNames;
Run Code Online (Sandbox Code Playgroud)
我有以下函数来返回枚举名称:
const char* gofBoard::getSettingName(unsigned x) {
return settingNames[static_cast<SettingName>(x)];
}
Run Code Online (Sandbox Code Playgroud)
从我读到的内容来看,这应该可以工作,但该函数不会返回任何内容。没有编译时错误,也没有运行时错误。
我配置了一个带有多个spring-boot子项目的gradle项目,它看起来可以正常运行,但是由于某种原因,“发行版”目录中有2个归档文件,一个带有“ -boot”后缀,另一个没有。带后缀的仅包含当前项目jar,而没有任何依赖关系,带后缀的仅包含启动应用程序所需的全部内容。我敢肯定,上次尝试构建spring-boot项目时,没有生成该其他归档文件,并且不确定更改了什么。如何停止这些对我无用的档案的生成?
父项目build.gradle:
allprojects {
group '...'
apply plugin: 'java'
}
subprojects {
sourceCompatibility = 1.9
targetCompatibility = 1.9
repositories {
...
}
}
Run Code Online (Sandbox Code Playgroud)
spring-boot子项目build.gradle:
apply plugin: 'application'
apply plugin: 'org.springframework.boot'
mainClassName = '...'
dependencies {
...
}
buildscript {
ext {
springBootVersion = '2.0.0.M5'
}
repositories {
...
}
dependencies {
classpath("org.springframework.boot:spring-boot-gradle-plugin:${springBootVersion}")
}
}
Run Code Online (Sandbox Code Playgroud) 我需要将Spring依赖项注入到JPA实体侦听器中。我知道我可以使用@Configurable和Spring的AspectJ weaver作为javaagent来解决此问题,但这似乎是一个棘手的解决方案。还有其他方法可以完成我想做的事情吗?