我想用MySQL和JPA设置Spring Boot.为此我创造: 人
package domain;
import javax.persistence.*;
@Entity
@Table(name = "person")
public class Person {
@Id
@GeneratedValue
private Long id;
@Column(nullable = false)
private String firstName;
// setters and getters
}
Run Code Online (Sandbox Code Playgroud)
PersonRepository
package repository;
import domain.Person;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.repository.CrudRepository;
public interface PersonRepository extends CrudRepository<Person, Long> {
Page<Person> findAll(Pageable pageable);
}
Run Code Online (Sandbox Code Playgroud)
PersonController
package controller;
import domain.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import repository.PersonRepository;
@Controller
public class PersonController {
@Autowired
private PersonRepository personRepository;
@RequestMapping("/")
@ResponseBody
public …Run Code Online (Sandbox Code Playgroud) 我想获得完整的消息体.所以我尝试:
Message gmailMessage = service.users().messages().get("me", messageId).setFormat("full").execute();
Run Code Online (Sandbox Code Playgroud)
为了获得身体,我尝试:
gmailMessage.getPayload().getBody().getData()
Run Code Online (Sandbox Code Playgroud)
但结果总是如此null.如何获得完整的邮件正文?
我有AngularJS webapp并使用Tomcat 7启动它.使用$locationProvider.html5Mode(true)我从url中删除散列'#'
localhost:8080/App/#/login -> localhost:8080/App/login
Run Code Online (Sandbox Code Playgroud)
但现在,当我刷新时,localhost:8080/App/login我有404 error.如何配置Tomcat7进行localhost:8080/App/login刷新?
的app.config:
$urlRouterProvider.otherwise("/login/");
$stateProvider
.state('home', {
abstract: true,
templateUrl: 'dist/view/home.html',
controller: 'HomeCtrl'
});
$locationProvider.html5Mode(true);
Run Code Online (Sandbox Code Playgroud)
index.html的:
<head>
<meta charset="utf-8">
<script>
document.write('<base href="' + document.location + '" />');
</script>
</head>
Run Code Online (Sandbox Code Playgroud) 我有一个Java代码:
String searchPerson = "select * from persons where surname like ? and name like ?";
//connect to DB
PreparedStatement statement = connect.prepareStatement(searchPerson);
statement.setString(1,"%"+ surname + "%");
statement.setString(2, "%" + name + "%");
ResultSet resultPerson = statement.executeQuery(searchPerson);
//..code
Run Code Online (Sandbox Code Playgroud)
然后我有SQLException:
你的SQL语法有错误; 检查与您的MySQL服务器版本对应的手册,以便在"?"附近使用正确的语法
我想处理Spring Security SAML.为此,我开始探索Spring Security SAML.一开始,我在SSOCircle创建了一个帐户.比我配置IDP元数据和生成SP元数据(4.2.2和4.2.3).在entityId我设定:
<bean id="metadataGeneratorFilter" class="org.springframework.security.saml.metadata.MetadataGeneratorFilter">
<constructor-arg>
<bean class="org.springframework.security.saml.metadata.MetadataGenerator">
<property name="entityId" value="http://idp.ssocircle.com"/>
</bean>
</constructor-arg>
</bean>
Run Code Online (Sandbox Code Playgroud)
当我开始申请时,我有:
Error occurred:
Reason: Unable to do Single Sign On or Federation.
Run Code Online (Sandbox Code Playgroud)
要么
Error occurred:
Reason: Unable to get AuthnRequest.
Run Code Online (Sandbox Code Playgroud)
如何配置Spring Security SAML?