在 GKE 上,K8s Ingress 是 Compute Engine 提供的负载均衡器,它们有一定的成本。例如 2 个月我支付了 16.97 欧元。
在我的集群中,我有 3 个命名空间(default,dev和prod),因此为了降低成本,我想避免产生 3 个 LoadBalancer。问题是如何配置当前的指向正确的命名空间?
GKE 要求入口的目标 Service 类型为NodePort,由于该限制,我被卡住了。
我想做类似的事情:
apiVersion: extensions/v1beta1
kind: Ingress
metadata:
namespace: dev
annotations: # activation certificat ssl
kubernetes.io/ingress.global-static-ip-name: lb-ip-adress
spec:
hosts:
- host: dev.domain.com
http:
paths:
- path: /*
backend:
serviceName: dev-service # This is the current case, 'dev-service' is a NodePort
servicePort: http
- host: domain.com
http:
paths:
- path: /*
backend:
serviceName: …Run Code Online (Sandbox Code Playgroud) Keycloak 是否可以使用 JWT 以外的其他令牌格式?Keycloak 总是发送 JWT 令牌,但我显然不想要那种 JWT 格式。Opaque tokenkeycloak是否可以有一种或其他格式?
谢谢
默认情况下@DataJpaTest扫描所有 jpa 存储库和@Entity. 就我而言,我有 5 个存储库包和 5 个实体包。例如
com.acme.product.entity与 相关联 与
com.acme.product.repository
com.acme.users.entity相关联 与
com.acme.users.repository
com.acme.client.entity相关联
com.acme.client.repository
等等....
我想在单独的课程中测试每个部分。例如
@RunWith(SpringRunner.class)
@DataJpaTest
//Some configurations to import only product repositories and product entities
public class TestProductRepository {
@Autowired
TestEntityManager entityManager;
}
Run Code Online (Sandbox Code Playgroud)
请注意,我已经配置了 5 个不同的,EntityManager我想导入它们并使用例如productEntityManagerin 中的TestProductRepository而不是TestEntityManager加载所有存储库/实体的默认值。
多谢
在工作中,我在Linux Mint上使用IntelliJ并设置了DejaVu Sans Mono字体。在家里,我使用Windows10,但是在字体设置面板上看不到该字体。有没有办法添加它,因为defaut提出的建议真的没用。非常感谢
IntelliJ中是否有一种快捷方式(或一种定义方式)来切换2个单词?例如。
final static
切换到快捷方式static final?
我有这个多模块项目:
Parent Pom
|
|----Main module (@SpringBootApplcation and application.properties)
|
|----Module I
|
|----Module II
|
|----Module III
Run Code Online (Sandbox Code Playgroud)
主模块依赖于其他模块,并且包含messages.properties和messages_fr.propertiesunderresources/messages/以及application.properties我定义MessageResourcebean 的位置spring.messages.basename=messages/messages。现在我想将messages.properties文件放入每个模块中。例如,对于模块 I,src/main/resources/messages/messages.properties模块 II 的内容相同。我的问题是,如何在MessageResource定义的 bean中添加模块的消息application.properties?我尝试了几个这样的声明:
spring.messages.basename=messages/messages,classpath:/com/company/moduleI/resources/messages/messages或者spring.messages.basename=messages/messages,classpath:moduleI/resources/messages/messages但没有一个有效。有办法实现这一点吗?
spring internationalization spring-boot application.properties
我定义了这个约束:
\n\n@Size( min = 5 )\n@NotBlank\n@Pattern.List( {\n @Pattern( regexp = "(?=.*[0-9]).+", message = "au moins un chiffre" ),\n @Pattern( regexp = "(?=.*[a-z]).+", message = "au moins une lettre miniscule" ),\n @Pattern( regexp = "(?=.*[A-Z]).+", message = "au moins une lettre majiscule" ),\n @Pattern( regexp = "(?=.*[!@#$%^&*+=?-_()/\\"\\\\.,<>~`;:]).+", message = "au moins un caract\xc3\xa8re sp\xc3\xa9cial" ),\n @Pattern( regexp = "(?=\\\\S+$).+", message = "pas d\'espace" )\n} )\nprivate String password;\nRun Code Online (Sandbox Code Playgroud)\n\n但是,当我发送不遵守此约束的无效密码时,出现以下异常:
\n\njava.lang.annotation.AnnotationFormatError: Duplicate annotation for class: interface javax.validation.constraints.Pattern: @javax.validation.constraints.Pattern(flags=[], groups=[], message=au …Run Code Online (Sandbox Code Playgroud) 我使用 Spring Security OAuth2 设置了一个 Spring Boot 多模块(5 个模块)应用程序。一切都运行良好,但随着应用程序的增长,我想将每个模块中的安全部分分开。主模块启用一切:
@SpringBootApplication
@EnableResourceServer
@EnableAuthorizationServer
@EnableWebSecurity(debug = true)
public class Application {
...
}
Run Code Online (Sandbox Code Playgroud)
现在在每个模块中我定义了一个类型的beanResourceServerConfigurer
@Configuration
@Order(2)
public class Module1SecurityFilterChain extends ResourceServerConfigurerAdapter {
@Override
public void configure( HttpSecurity http ) throws Exception {
http.sessionManagement().sessionCreationPolicy( STATELESS );
http.antMatcher( "/module1/**")
.authorizeRequests()
.antMatchers( "/module1/resource").authenticated()
.antMatchers( "/module1/test" ).authenticated()
.anyRequest().access( "#oauth2.hasScope('webclient')" );
}
}
Run Code Online (Sandbox Code Playgroud)
与 module2 相同:
@Configuration
@Order(1)
public class Module2SecurityFilterChain extends ResourceServerConfigurerAdapter {
@Override
public void configure( HttpSecurity http ) throws Exception {
http.sessionManagement().sessionCreationPolicy( STATELESS …Run Code Online (Sandbox Code Playgroud) 我想避免在微服务应用程序中复制我的POJO,所以我想知道是否有办法(如代理)?
我的意思是,有没有办法Service A访问在一个内部定义的POJO(或其他类/接口)Service B而不在物理上创建这些POJO classe文件Service A?
微服务架构面临的重大挑战就是这一点,我找不到解决问题的方法.
我有一个在 GCP 上运行的 Spring Boot 应用程序(现在 1 年了),我想更新它,但是当我在mvn appengine:run本地运行时出现此错误:
[INFO] GCLOUD: INFOS: javax.servlet.ServletContext log: 2 Spring WebApplicationInitializers detected on classpath
[INFO] GCLOUD: java.lang.IllegalArgumentException: Unable to find the main class to restart
[INFO] GCLOUD: at org.springframework.util.Assert.notNull(Assert.java:198)
[INFO] GCLOUD: at org.springframework.boot.devtools.restart.Restarter.doStart(Restarter.java:277)
[INFO] GCLOUD: at org.springframework.boot.devtools.restart.Restarter.start(Restarter.java:265)
[INFO] GCLOUD: at org.springframework.boot.devtools.restart.Restarter.lambda$immediateRestart$0(Restarter.java:173)
[INFO] GCLOUD: at org.springframework.boot.devtools.restart.Restarter$LeakSafeThread.run(Restarter.java:637)
[INFO] GCLOUD: d?c. 02, 2018 4:30:20 PM com.google.appengine.api.datastore.dev.LocalDatastoreService cleanupActiveServices
[INFO] GCLOUD: INFOS: scheduler shutting down.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 53.255 s …Run Code Online (Sandbox Code Playgroud) java google-app-engine spring spring-boot google-cloud-platform
spring-boot ×6
java ×2
spring ×2
fonts ×1
jwt ×1
keycloak ×1
kubernetes ×1
settings ×1
spring-data ×1
spring-mvc ×1
token ×1