这段执行 Hibernate 查询的代码可以作为 Java 程序运行,但是如果我将它作为 Spring Boot 运行,它会失败,我在某处读过它可能是因为 Hibernate 5.1 中的错误。可能吗?我正在使用 Spring Boot 2.0。这会是个问题吗?
@SpringBootApplication
public class SpringCd244ManyToManyBootApplication {
public static void main(String[] args) {
SpringApplication.run(SpringCd244ManyToManyBootApplication.class, args);
// create session factory
SessionFactory factory = new Configuration()
.configure("hibernate.cfg.xml")
.addAnnotatedClass(Instructor.class)
.addAnnotatedClass(InstructorDetail.class)
.addAnnotatedClass(Course.class)
.addAnnotatedClass(Review.class)
.addAnnotatedClass(Student.class)
.buildSessionFactory();
// create session
Session session = factory.getCurrentSession();
try {....
Run Code Online (Sandbox Code Playgroud)
在 Spring Boot 中运行它时遇到的错误。有任何想法吗?
2018-01-11 20:45:33.261 INFO 5772 --- [ restartedMain] org.hibernate.orm.connections.pooling : HHH10001008: Cleaning up connection pool [jdbc:mysql://localhost:3306/webapp?useSSL=false]
Exception in thread "restartedMain" java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at …Run Code Online (Sandbox Code Playgroud) 我正在尝试通过 AWS 身份验证,以通过 WordPress 编辑器中的 javascript 代码向 AWS Polly 发送请求。我按照互联网上的几个例子进行操作,但总是出错。
const CREDS = {
accessKeyId: "xxx",
secretAccessKey: "xxx"
// region: "eu-west-1"
};
axios(
aws4.sign(
{
host: "polly.eu-west-1.amazonaws.com",
method: "GET",
url:
"https://polly.eu-west-1.amazonaws.com/v1/voices?Engine=neural&IncludeAdditionalLanguageCodes=no&LanguageCode=en-US",
data: {},
body: {},
path:
"/v1/voices?Engine=neural&IncludeAdditionalLanguageCodes=no&LanguageCode=en-US"
},
CREDS
)
).then(res => {
console.log(res);
// ...
});
Run Code Online (Sandbox Code Playgroud)
xhr.js:126 拒绝设置不安全标头“Host” setRequestHeader @ xhr.js:126 forEach @ utils.js:238dispatchXhrRequest@xhr.js:120 xhrAdapter@xhr.js:12dispatchRequest@dispatchRequest.js:52 Promise。然后(异步)请求@ Axios.js:61 包装@bind.js:9(匿名)@edit.js:88 Vh @react-dom.min.js?ver=16.9.0:163 呃@react-dom。 min.js?ver=16.9.0:14 Xh@react-dom.min.js?ver=16.9.0:14af@react-dom.min.js?ver=16.9.0:14 Yh@react-dom .min.js?ver=16.9.0:164 nd @react-dom.min.js?ver=16.9.0:15 nc @react-dom.min.js?ver=16.9.0:15 @react- dom.min.js?ver=16.9.0:38 Ac@react-dom.min.js?ver=16.9.0:39 stable_runWithPriority@react.min.js?ver=16.9.0:26 Ma @react-dom .min.js?ver=16.9.0:52 为 @react-dom.min.js?ver=16.9.0:119 xi …
我需要为 Azure TTS 创建此标头:
<speak version="1.0"
xmlns="https://www.w3.org/2001/10/synthesis"
xmlns:mstts="https://www.w3.org/2001/mstts"
xml:lang="en-US">
Run Code Online (Sandbox Code Playgroud)
这是用于创建 xml:lang 键的代码:
xml_body = ElementTree.Element('speak', version='1.0')
xml_body.set('{http://www.w3.org/XML/1998/namespace}lang', 'en-us')
Run Code Online (Sandbox Code Playgroud)
我试图创建 xmlns:mstts 没有成功。这不起作用:
xml_body.set('{https://www.w3.org/2001/10/synthesis}mstts', 'https://www.w3.org/2001/mstts' )
Run Code Online (Sandbox Code Playgroud)
因为这会产生以下输出:
<speak version="1.0"
xmlns="https://www.w3.org/2001/10/synthesis"
xmlns:mstts="https://www.w3.org/2001/mstts"
xml:lang="en-US">
Run Code Online (Sandbox Code Playgroud)
请注意元素属性中的xmlns:ns0和ns0:mstts问题<speak>。
有任何想法吗?
我不明白为什么这个折叠不能编译。谁能给我一个线索?
sealed trait ListG[A] {
def fold[A,B](end: B, f: (A,B) => B): B = this match {
case End() => end
case Cons(hd,tl) => f(hd, tl.fold(end,f))
}
}
Run Code Online (Sandbox Code Playgroud)
错误:(20, 28) 类型不匹配;发现:hd.type(具有底层类型A)需要:A case Cons(hd,tl) => f(hd, tl.fold(end,f)) ^ final case class EndA extends ListG[A] final case class Cons [A](hd:A, tl:ListG[A]) 扩展 ListG[A]
amazon-polly ×1
axios ×1
elementtree ×1
hibernate ×1
java ×1
python ×1
scala ×1
spring ×1
xml ×1