小编Mic*_*tch的帖子

有没有办法在Spring引导中获取所有配置属性的名称?

我真的很喜欢Spring.我使用spring boot提供的外部配置功能.它运行良好,我在几个配置类中使用它,通常只使用默认值.现在我想概述一下我使用的配置属性.这意味着我需要知道所有使用@Value(...)或设置的属性@ConfigurationProperties(prefix = ...).有没有办法从Spring获取此信息?我可以用反射做到这一点,但我认为这不是最好的方法.

java configuration spring properties spring-boot

5
推荐指数
1
解决办法
1421
查看次数

模拟器使用 int21h/ah=09h 显示“在 2000 个字节之后找不到错误字节 24h”

我必须使用EMU8086在汇编中做一个简单的计算器,但每次我尝试启动它时,EMU8086都会出现此错误:

INT 21h, AH=09h - 
address: 170B5
byte 24h not found after 2000 bytes.
; correct example of INT 21h/9h:
mov dx, offset msg
mov ah, 9
int 21h
ret
msg db "Hello$"
Run Code Online (Sandbox Code Playgroud)

我检查了其他东西,但没有错误:

data segment
    choice db ?
    snum1 db 4 dup(?)
    snum2 db 4 dup(?)
    sres db 4 dup(?)
    num1 db ?
    num2 db ?
    res db ?
    ;;menu1 db "Chose a function to procced", 10, 13, "Add [+]", 10, 13, "Sub [-]", 10, …
Run Code Online (Sandbox Code Playgroud)

x86 assembly dos x86-16 emu8086

5
推荐指数
1
解决办法
3589
查看次数

INT 16h/AH=0h 不等待引导加载程序中的按键

我使用 GNU 汇编器和 AT&T 语法编写了我的第一个引导加载程序。它应该打印hello world到屏幕上,然后通知用户按任意键将导致重新启动。只有按下某个键后才会启动重新启动。我的引导加载程序代码不等待按键,并在打印信息后自动重新启动。为什么此代码不等待击键,我该如何修复它?

我的引导扇区代码:

#generate 16-bit code
.code16

#hint the assembler that here is the executable code located
.text
.globl _start;
#boot code entry
_start:
  jmp _boot                           #jump to boot code
  welcome: .asciz "Hello, World\n\r"  #here we define the string
  AnyKey: .asciz "Press any key to reboot...\n\r"
 .macro mWriteString str              #macro which calls a function to print a string
      leaw  \str, %si
      call .writeStringIn
 .endm

 #function to print the string
 .writeStringIn:
      lodsb
      orb  %al, %al …
Run Code Online (Sandbox Code Playgroud)

assembly gnu-assembler bootloader att x86-16

5
推荐指数
1
解决办法
1354
查看次数

在32位Windows上使用NASM在程序集中创建exe文件

我正在使用32位Windows 7上的NASM以汇编语言编写一个hello world程序.我的代码是:

section .text 
global main ;must be declared for linker (ld) 
main: ;tells linker entry point 
    mov edx,len ;message length 
    mov ecx,msg ;message to write 
    mov ebx,1 ;file descriptor (stdout) 
    mov eax,4 ;system call number (sys_write) 
    int 0x80 ;call kernel 
    mov eax,1 ;system call number (sys_exit) 
    int 0x80 ;call kernel 

section .data 
    msg db 'Hello, world!', 0xa ;our dear string 
    len equ $ - msg ;length of our dear string
Run Code Online (Sandbox Code Playgroud)

我把这个程序保存为hello.asm …

windows x86 assembly linker nasm

5
推荐指数
3
解决办法
1万
查看次数

x86指令编码如何选择操作码

cmpw %ax -5x86-64的编码指令,来自Intel-instruction-set-reference-manual时,我有两个操作码可供选择:

3D iw CMP AX, imm16 I Valid Valid Compare imm16 with AX.
83 /7 ib CMP r/m16, imm8 MI Valid Valid Compare imm8 with r/m16.
Run Code Online (Sandbox Code Playgroud)

所以会有两个编码结果:

66 3d fb ff ; this for opcode 3d
66 83 f8 fb ; this for opcode 83
Run Code Online (Sandbox Code Playgroud)

那么哪一个更好?

我在下面尝试了一些在线反汇编程序

两者都可以反汇编到原点指令.但为什么6683fb00也有效,有效663dfb.

compiler-construction assembly x86-64 disassembly

5
推荐指数
1
解决办法
525
查看次数

放置堆栈并加载内核的位置

我是操作系统开发的新手,我很好奇我在开发自己的bootloader时遇到的问题.我的操作系统将以汇编语言编写,并将以16位实模式运行.

我知道堆栈是什么,我的印象是它向下扩展到内存中.如果我错了,请纠正我.我知道如何从软盘中将基本内核加载到内存中,我不相信这是问题所在.

我遇到的问题是我不确定在哪里放置堆栈并将内核加载到内存中.我试过像这样创建我的堆栈,我遇到了问题:

mov ax, 0x0000
mov ss, ax
mov sp, 0xFFFF
Run Code Online (Sandbox Code Playgroud)

我正在加载我的内核0x1000:0x0000.当我推送并稍后在我的函数中弹出易失性寄存器时print,我的内核只是第二次挂起call print.这是我的print功能:

print:
    push ax
    push bx
    push cx

    mov al, [si]
    cmp al, 0
    je p_Done

    cmp al, 9
    je p_Tab

    mov ah, 0xE
    int 0x10

    cmp al, 10
    je p_NewLine
   p_Return:
    inc si
    jmp print
  p_Tab:
    xor cx, cx
   p_Tab_Repeat:
    cmp cx, 8
    je p_Return
    mov ah, 0xE
    mov al, " " …
Run Code Online (Sandbox Code Playgroud)

assembly stack real-mode osdev x86-16

5
推荐指数
1
解决办法
230
查看次数

在之前看到相同的绑定后不加载程序集,并且失败并显示 hr = 0x80070002'

我看到一个奇怪的问题,一旦程序集无法加载,它就不会从具有相同父进程的不同进程加载。假设 Parent.exe 首先创建 Child1.exe,并尝试使用以下命令加载程序集

Type.GetType("TypeName, AssemblyName1") 
Run Code Online (Sandbox Code Playgroud)

它失败,因为程序集不在探测路径中。我收到预期的警告:

WRN:为程序集提供了部分绑定信息

但是,当 Parent.exe 创建 Child2.exe 并且 AssemblyName1 位于其探测路径中时,它仍然无法加载 AssemblyName1。Fusion 日志显示它甚至没有尝试探测并给出错误消息

日志:之前看到过相同的绑定,但失败,hr = 0x80070002

我看到这个是因为 Child1.exe 和 Child2.exe 都是从 Parent.exe 创建的吗?

我很困惑。我了解加载上下文在应用程序域中共享,但我从未见过跨进程共享加载失败缓存。也许我误诊了?

.net c# .net-assembly

5
推荐指数
0
解决办法
1698
查看次数

Spring启动应用程序在没有-Djava.net.preferIPv4Stack = true和-Djava.net.preferIPv4Addresses参数的情况下侦听IPv6


关于Spring boot jar的问题.在生产机器上运行jar时:

java -jar xyz.jar

它不响应我的要求.因为它正在监听ipv6.

但当我运行应用程序为
java -jar xyz.jar -Djava.net.preferIPv4Stack = true -Djava.net.preferIPv4Addresses时

它回应了我的要求.

是生产机器的配置导致应用程序通过ipv6监听,还是有其他原因?

幸运的是
-Djava.net.preferIPv4Stack = true
-Djava.net.preferIPv4Addresses
参数解决了我的问题.但我很困惑!!

注意:Tomcat用作嵌入式服务器.
Spring启动版1.5.4 RELEASE

spring jar ipv4 ipv6 spring-boot

5
推荐指数
1
解决办法
1982
查看次数

如何在64位NASM中使用malloc和free?

在 64 位 NASM 中,我使用 C 库中的 malloc() 分配 8000 字节的内存块,当我完成分配时,我通过调用 free() 来释放它。

我的研究提出了很多关于如何在 64 位 NASM 中执行此操作的相互矛盾的信息,并且许多信息是 32 位的,其中调用约定不同,或者是 C 或 C++,而不是 NASM。

我认为我的 malloc 部分是正确的,但我不确定 free 部分。我发布这个问题是因为我不想测试它并分配但未释放内存块。

所以我的两个问题很简单:
(1) 我是否有权利使用 64 位 NASM?
(2) Windows 和 Linux 的语法相同吗?

我仅显示程序的 malloc 和 free 部分:

extern malloc
extern free

push rdi

; Allocate the memory buffer
mov rdi,8000
call malloc
mov [array_pointer],rax ;array_pointer is initialized in .data

; Code that uses the buffer goes here.  

; Free the memory buffer …
Run Code Online (Sandbox Code Playgroud)

malloc free assembly x86-64 nasm

5
推荐指数
1
解决办法
3942
查看次数

Spring Boot应用程序在反向代理后面重定向

因此,我尝试在反向代理后面设置一个 Spring Boot 应用程序,但是当我使用它时,HttpServletResponse.redirect("/")它总是重定向到内部 url。无论有没有 都会发生这种情况use-forward-headers: true

我从反向代理获得的标头如下:

upgrade-insecure-requests: 1
forwarded: for=10.x.x.x;host=internal-domain.com;proto=http
x-forwarded-server: external-domain.com
host: internal-domain.com
x-forwarded-host: internal-domain.com
x-forwarded-port: 80
x-forwarded-proto: http
Run Code Online (Sandbox Code Playgroud)

我无法更改反向代理返回的内容。

如果有人可以提供帮助,那就太棒了:) 谢谢

proxy spring reverse tomcat spring-boot

5
推荐指数
0
解决办法
1415
查看次数