之间有什么区别
vars_files: 指令
和
-include_vars模块
如果不赞成使用上述任何一种方法,则应使用哪种方法?
你碰巧知道解释为什么java安全管理器不禁止创建新线程或启动它们吗?新的FileWriter在安全管理器下,但新的Thread()和threadInstance.start()都不是更安全的安全管理器,并且可以调用.
我的ssl证书的证书吊销列表有问题.
如何查看crl文件的截止日期?如何验证crl文件?
语境:
我是java程序员,正在阅读Uncle Bob Agile软件开发.关于ISP接口隔离原则,给出了一个我理解为的参数:
让我们:
interface Service {
function doA();
}
class ServiceImpl implements Service {...}
class ServiceClient {
// ServiceImpl is injected; eg either through constructor or setter
private Service service;
function useOnlyDoA() {
service.doA();
}
}
Run Code Online (Sandbox Code Playgroud)
现在,如果接口服务发生变化,例如doB()添加了方法,那么所有依赖类ServiceClient都必须重新编译,即使它们不使用添加的方法!(真??)
我坚信,关于java if ServiceClient是否在包中,例如client.jar,接口Servicein service.jar和ServiceImplin impl.jar,然后client.jar不必重新编译和重建,如果它不使用来自Service接口的新方法,它可以与新版本的service.jar和impl.jar.在我看来,事情在java中是这样的.是其他在例如c ++或其他语言?
可能是在C++更坏,如 /sf/answers/282373031/
说清楚:
我不是要求重新编译实现更改接口的类(这很明显,它必须实现新添加的方法).但我问我是否必须重新编译使用此接口的类ServiceClient,即使类没有使用新添加的方法.可能在c ++ BC变化和客户端真的必须重新编译,但在我看来,不是在java中.
编辑:
我在java中实现了一个测试.4个罐子:
public …我在 sprint boot 2 执行器中找不到缓存指标。我应该如何查询它们或激活或调试?
org.springframework.boot:spring-boot-starter-actuator:2.2.5.RELEASE
我可以在http://localhost:8080/actuator/caches ->下看到两个缓存
{
"cacheManagers": {
"cacheManager": {
"caches": {
"calendar": {
"target": "org.ehcache.jsr107.Eh107Cache"
},
"foo": {
"target": "org.ehcache.jsr107.Eh107Cache"
}
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
ehcache.xml:
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://www.ehcache.org/v3"
xmlns:jsr107="http://www.ehcache.org/v3/jsr107"
xsi:schemaLocation="
http://www.ehcache.org/v3 http://www.ehcache.org/schema/ehcache-core-3.0.xsd
http://www.ehcache.org/v3/jsr107 http://www.ehcache.org/schema/ehcache-107-ext-3.0.xsd">
<cache alias="calendar" >
<expiry>
<ttl unit="seconds">60</ttl>
</expiry>
<resources>
<heap unit="entries">2</heap>
<offheap unit="MB">100</offheap>
</resources>
</cache>
<cache alias="foo" >
<expiry>
<ttl unit="seconds">60</ttl>
</expiry>
<resources>
<heap unit="entries">2</heap>
<offheap unit="MB">100</offheap>
</resources>
</cache>
</config>
Run Code Online (Sandbox Code Playgroud)
我在http://localhost:8080/actuator/metrics/下看不到缓存、日历或 foo (其他指标如“jvm.memory.max”可见)
相似地
http://localhost:8080/actuator/metrics/cache.calendar.size
http://localhost:8080/actuator/metrics/cache.calendar.gets
http://localhost:8080//actuator/metrics/cache.gets
不返回任何内容。
如何获取缓存指标?
http://localhost:8080/actuator/metrics/cache?tag=calendar:size也不返回任何内容,在日志中我可以看到: …
一个简单的 spring 服务,具有插入并在插入后抛出运行时异常的方法。运行时异常应该导致回滚。
@Transactional()
public void insertAndThrowRuntimeEx() {
Order order = new Order();
entityManager.persist(order);
throw new RuntimeException("Unexpected runtime exception");
}
Run Code Online (Sandbox Code Playgroud)
仅当我使用以下命令配置 dataSource 时,回滚才会正确显示:
<jdbc:embedded-database id="dataSource" type="H2" /> <!-- with this configuration there is correct rollback -->
Run Code Online (Sandbox Code Playgroud)
但是当我在独立模式下使用数据库时,没有回滚,或者回滚无效:
<bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" <!-- here inserted record remains in database -->
p:driverClassName="org.h2.Driver" p:url="jdbc:h2:tcp://localhost/databases/test1"
p:username="sa" p:password="" />
Run Code Online (Sandbox Code Playgroud)
为什么事务回滚可以在 H2 嵌入式数据库模式下正常工作,而在服务器模式下不能正常工作?
ps,还配置了事务管理器
@Bean
public PlatformTransactionManager transactionManager() {
JpaTransactionManager manager = new JpaTransactionManager( localContainerEntityManagerFactoryBean().getObject() );
return manager;
}
<tx:annotation-driven transaction-manager="transactionManager" />
Run Code Online (Sandbox Code Playgroud)
spring 调试日志说事务已回滚:
现在抛出运行时异常
2014-07-03 20:02:05,965 …Run Code Online (Sandbox Code Playgroud) 依赖注入是某种形式的控制反转。
我正在做来自haskell.mooc.fi/Exercises7的Set7.hs
\n-- Ex 5: reverse a NonEmpty list.\n--\n-- PS. The Data.List.NonEmpty type has been imported for you\n\n-- below doesn\'t work\n-- reverseNonEmpty :: NonEmpty a -> NonEmpty a\n-- reverseNonEmpty (h:|tail) = head reversed :| (tail reversed)\n-- where \n-- reversed = reverse (h:tail)\n\n-- below works\nreverseNonEmpty :: NonEmpty a -> NonEmpty a\nreverseNonEmpty (h :| tail) = head reversed :| revTail\n where\n reversed = reverse (h : tail)\n -- revTail = (tail reversed) - this doesn\'t work, but WHY???\n (_:revTail) …Run Code Online (Sandbox Code Playgroud) 我按照配置子请求身份验证/auth_request /auth;
中的描述进行操作
如果 /auth 返回 401 或 403,如何重定向到登录页面?
我尝试过
error_page 401 403 = @error401;
location = ^/securedUrl {
add_header dbg-header dbg_ws_3;
auth_request /auth;
proxy_pass http://auth-module:8080;
proxy_http_version 1.1;
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "upgrade";
proxy_pass_header x-remaining-session-time;
}
location @error401 {
return 302 /login-module/login;
}
location = /auth {
internal;
rewrite ^/(.*) /is-authorized break;
proxy_pass http://auth-module:8080;
proxy_pass_request_body off;
proxy_set_header Content-Length "";
proxy_set_header X-Original-URI $request_uri;
}
Run Code Online (Sandbox Code Playgroud)
但它不起作用,我在浏览器中收到 401
我开始阅读 E. Evans DDD 的第 5 章,并尝试对这些概念进行头或尾。
在 ddd 的上下文中,什么是实体,什么不是实体,什么是值对象?
在我的 Hibernate 映射中查看Value 对象或实体对象?- 但它是关于 Hibernate,而不是 DDD,我问的是 DDD
例如,如果我们使用了某个对象数据库,我们可能会将 Order 与其 OrderLines 一起存储,不是吗?
好的,现在还有其他疑问。假设我们有两个不同的系统,一个是 Java,另一个是 Python。一个用于计费,另一个用于营销。他们都有一个客户实体。
1) CDI @Interceptor 的@Priority 是什么意思?
2)它与 beans.xml 中声明的拦截器顺序有什么关系?
3) @Priority 可以在 xml 文件中被覆盖吗?