我已经分离了dataSourceConfig.yml数据库配置文件:
environments:
development:
dataSource:
dbCreate: none
url: jdbc:oracle:thin:xxxxxx
driverClassName: oracle.jdbc.OracleDriver
dialect: org.hibernate.dialect.Oracle10gDialect
username: xxxx
password: xxxx
test:
dataSource:
dbCreate: none
url: jdbc:oracle:thin:xxxxx
driverClassName: oracle.jdbc.OracleDriver
dialect: org.hibernate.dialect.Oracle10gDialect
username: xxxxx
password: xxxxx
Run Code Online (Sandbox Code Playgroud)
我连接到项目中的Application.java:
class Application extends GrailsAutoConfiguration implements EnvironmentAware {
static void main(String[] args) {
GrailsApp.run(Application, args)
}
@Override
void setEnvironment(Environment environment) {
String configPath = environment.getProperty("local.config.location")
Resource resourceConfig = new FileSystemResource(configPath)
YamlPropertiesFactoryBean ypfb = new YamlPropertiesFactoryBean()
ypfb.setResources([resourceConfig] as Resource[])
ypfb.afterPropertiesSet()
Properties properties = ypfb.getObject()
environment.propertySources.addFirst(new PropertiesPropertySource("local.config.location", properties)) …Run Code Online (Sandbox Code Playgroud) 我想从Java API(auth0客户端)获取Auth0用户列表。我可以做吗?基于Java + Spring Security的API。我试图用RestTemplate做到这一点:
List findAllUsers(){
String idToken = RestService.getIdToken()
HttpHeaders headers = new HttpHeaders()
headers.set("Authorization", "Bearer $idToken");
List users = []
try{
ResponseEntity entity = restTemplate.exchange(issuer+"api/v2/users", HttpMethod.GET, new HttpEntity<Object>(headers), List)
users = entity.getBody()
} catch (HttpClientErrorException e){
e.printStackTrace()
}
return users
}
Run Code Online (Sandbox Code Playgroud)
但是我正在获得403禁止状态。